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

标签 ubuntu nginx

突然我得到了下面的 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   - 

我被难住了。我该如何调试?

我在端口 8070 上使用带有代理传递的 uwsgi。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

最佳答案

我通过运行解决了这个问题:

sudo apachectl stop

事实证明 apache 在后台运行并阻止 nginx 在所需端口上启动。

在 Ubuntu 上,运行:

sudo /etc/init.d/apache2 stop

关于ubuntu - nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14972792/

相关文章:

html - 很棒的字体没有加载到我的 apache 中

linux - 'No package nginx available' 错误 CentOS 6.5

ssl - 使用 nginx 配置为我的服务器上的单个目录强制使用 https

linux - 从端口 80 删除 nginx 并添加 apache

带有 rtmp 模块的 Nginx 流式视频点播与 HLS/http

nginx - 如何使用 vagrant docker 提供程序查看 Nginx 默认页面?

jquery - 使用 JQuery 绑定(bind)按键事件在 Chrome 中不起作用

linux - 使用 AWK 同一列中的数字之间的差异

python - 使用python在linux中访问文件的时间

Apache 停止重定向到 https ://from http://