曲径通幽论坛

标题: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) [打印本页]

作者: beyes    时间: 2015-8-7 17:42
标题: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
本来用 nginx 做了正向代理,端口放在 8088,而 80 端口也未曾被使用,看 nginx 的配置文件也没什么问题,但在访问服务器时,却仍然提示 nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)  错误。

用 netstat -ntpl 命令查看一下:
l# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      30998/nginx: worker
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      1010/uhttpd
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      1201/dnsmasq
tcp        0      0 192.168.2.1:8118        0.0.0.0:*               LISTEN      24176/privoxy
tcp        0      0 0.0.0.0:8088         0.0.0.0:*               LISTEN      32015/nginx
tcp        0      0 :::8081                 :::*                    LISTEN      1010/uhttpd
tcp        0      0 :::53                   :::*                    LISTEN      1201/dnsmasq

原来是一个 worker 占据这这个端口。

解决办法还是先 kill 掉这个 worker ,然后再重启一下 nginx,重启后再生成的 worker 就不会占据 80 端口了,而是由 nginx 的主进程来使用该端口。





欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2