Nginx + uWSGI在新鲜的Ubuntu安装 – 绑定错误端口80

我知道这是一个常见的问题,通常与Apache或其他已经在端口80上运行的服务有关,我已经做了大量的search和运行netstat,仍然没有find为什么我得到这个错误。

我重build了我的切片,重新安装了Ubuntu 10.04并安装了nginx + uwsgi。 它的工作,我能看到我的Django网站。 然后我从这个链接安装了Postgres8.4和Geodjango所需的其他堆栈。

之后,我试图重新启动nginx,我得到这个错误:

sudo /etc/init.d/nginx start Starting nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok configuration file /usr/local/nginx/conf/nginx.conf test is successful [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: still could not bind() 

我有nginx设置为听80.这是从netstat -l --numeric-ports | grep 80的输出 netstat -l --numeric-ports | grep 80

 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 

sudo lsof +M -i4输出:

 nginx 2330 root 8u IPv4 3195 0t0 TCP *:www (LISTEN) nginx 2331 www-data 8u IPv4 3195 0t0 TCP *:www (LISTEN) uwsgi 2335 s 4u IPv4 3259 0t0 TCP localhost:8000 (LISTEN) uwsgi 2352 s 4u IPv4 3259 0t0 TCP localhost:8000 (LISTEN) uwsgi 2353 s 4u IPv4 3259 0t0 TCP localhost:8000 (LISTEN) uwsgi 2354 s 4u IPv4 3259 0t0 TCP localhost:8000 (LISTEN) uwsgi 2355 s 4u IPv4 3259 0t0 TCP localhost:8000 (LISTEN) 

任何人有任何其他的想法如何我可以找出是什么阻止端口80?

编辑

粘贴我的/etc/init.d/nginx脚本: http : //dpaste.com/hold/400937/

你不应该restart作为你的初始化脚本的参数吗?

我期望

 sudo /etc/init.d/nginx start 

抱怨如果nginx已经在运行。 这听起来是这样的。

fuser -n tcp 80将显示使用端口80的进程的PID。

netstat -plan

将为您提供进程名称,然后使用killall -9

并重新启动你的nginx

我build议你从/ etc / nginx / sites-enabled粘贴你的实际configuration文件。你也可以尝试更加明确你绑定的IP地址。

最近,我在Ubuntu 10.10 KVM节点服务器上遇到了nginx(8.54)和uWsgi(.96)的奇怪现象。 我使用了非本地地址绑定,结合VLAN /绑定802.3ad和桥接,因此设置在理论上与来自提供商的“切片”相似。 我的直觉是,它与nginx有关,虽然Ubuntu的底层已经经历了巨大的变化。

我build议在configurationnginx的时候尽可能的明确。 特别是在单个接口上具有多个IP或别名IP地址的环境中。

http://linux-ip.net/html/adv-nonlocal-bind.html