nginx-nginx:[emerg] bind()到[::]:80失败(98:地址已在使用中) [英] nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

查看:95
本文介绍了nginx-nginx:[emerg] bind()到[::]:80失败(98:地址已在使用中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

突然我收到以下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?

我将uwsgi与端口8070上的代理传递一起使用.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地址.

如果您的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;

您可以通过在[::]:80上添加ipv6only=on来解决此问题,

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()到[::]:80失败(98:地址已在使用中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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