ubuntu – nginx – nginx:[emerg] bind()to [::]:80 failed(98:Address already in use)

前端之家收集整理的这篇文章主要介绍了ubuntu – nginx – nginx:[emerg] bind()to [::]:80 failed(98:Address already in use)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
突然我得到了下面的Nginx错误
* Restarting Nginx
 * Stopping Nginx Nginx
   ...done.
 * Starting Nginx Nginx
Nginx: [emerg] bind() to [::]:80 Failed (98: Address already in use)
Nginx: [emerg] bind() to [::]:80 Failed (98: Address already in use)
Nginx: [emerg] bind() to [::]:80 Failed (98: Address already in use)
Nginx: [emerg] bind() to [::]:80 Failed (98: Address already in use)
Nginx: [emerg] bind() to [::]:80 Failed (98: Address already in use)
Nginx: [emerg] still could not bind()
   ...done.
   ...done.

如果我跑

lsof -i :80 or sudo fuser -k 80/tcp

我什么都没有。没有在端口80

然后我运行下面:

sudo netstat -pan | grep ":80"
tcp        0      0 127.0.0.1:8070          0.0.0.0:*               LISTEN      15056/uwsgi     
tcp        0      0 10.170.35.97:39567      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39564      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39584      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39566      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39571      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39580      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39562      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39582      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39586      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39575      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39579      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39560      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39587      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39591      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39589      10.158.58.13:8080       TIME_WAIT   -

我被骗了。

如何调试?

我使用uwsgi与

代理通过端口8070.uwsgi正在运行。 Nginx不是。我使用ubuntu 12.4

下面是我的Nginx conf文件的相关部分

upstream uwsgi_frontend {
          server 127.0.0.1:8070;
        }
server {
listen 80;
        server_name 127.0.0.1;
        location = /favicon.ico {
                  log_not_found off;
                }



                location / {
                       include uwsgi_params;
                       uwsgi_buffering off;

                       uwsgi_pass 127.0.0.1:8070;
                 }
        }

这里是如何在ubuntu 12.04上安装Nginx

Nginx=stable;add-apt-repository ppa:Nginx/$Nginx;
apt-get update
apt get install Nginx-full
[::]:80是一个ipv6地址。

如果你有一个Nginx配置监听端口80和端口[::]:80,可能会导致此错误

我在我的默认网站 – 可用文件中有以下:

listen 80;
listen [::]:80 default_server;

你可以通过添加ipv6only = on到[::]:80这样解决这个问题:

listen 80;
listen [::]:80 ipv6only=on default_server;

有关详细信息,请参阅:

http://forum.linode.com/viewtopic.php?t=8580

http://wiki.nginx.org/HttpCoreModule#listen

原文链接:https://www.f2er.com/ubuntu/353179.html

猜你在找的Ubuntu相关文章