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

查看:33
本文介绍了nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我突然收到以下 nginx 错误

All of a sudden I am getting the below nginx error

 * 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 端口什么都没有

I get nothing. Nothing on port 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   - 

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

I am stumped. How do I debug this?

我在端口 8070 上使用 uwsgi 和代理传递.uwsgi 正在运行.Nginx 不是.我使用的是 ubuntu 12.4

I am using uwsgi with a proxy pass on port 8070. uwsgi is running. Nginx is not. I am using ubuntu 12.4

以下是我的 nginx conf 文件的相关部分

Below are the relevant portions of my nginx conf file

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 的方法

Here is how I install nginx on ubuntu 12.04

nginx=stable;add-apt-repository ppa:nginx/$nginx;
apt-get update
apt get install nginx-full

推荐答案

[::]:80 是一个 ipv6 地址.

[::]:80 is a ipv6 address.

如果您的 nginx 配置正在侦听端口 80 和端口 [::]:80,则可能会导致此错误.

This error can be caused if you have a nginx configuration that is listening on port 80 and also on port [::]:80.

我的默认站点可用文件中有以下内容:

I had the following in my default sites-available file:

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

您可以通过将 ipv6only=on 添加到 [::]:80 来解决这个问题,如下所示:

You can fix this by adding ipv6only=on to the [::]:80 like this:

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

有关更多信息,请参阅:

For more information, see:

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

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

这篇关于nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆