nginx-won';t停止/重新启动失败(98:地址已在使用)

nginx-won';t停止/重新启动失败(98:地址已在使用),nginx,ubuntu-14.04,Nginx,Ubuntu 14.04,版本: 这是Ubuntu 14.04的新版本 NGINX 1.4.6 总结: 发出服务nginx stop,不会停止服务器,发出nginx restart会导致失败!错误为已在使用中 详情: 我相信这是我的vhost的一个问题,如果我注释掉nginx.conf中启用的站点的include,它将正常运行。我已经阅读了多个站点关于ipv6only和ipv4的声明,但这似乎没有问题,因为这是开箱即用的默认设置 未安装Apache,nginx是唯一的服务器 调试: nginx -t nginx: the

版本: 这是Ubuntu 14.04的新版本 NGINX 1.4.6

总结: 发出服务nginx stop,不会停止服务器,发出nginx restart会导致失败!错误为已在使用中

详情: 我相信这是我的vhost的一个问题,如果我注释掉nginx.conf中启用的站点的include,它将正常运行。我已经阅读了多个站点关于ipv6only和ipv4的声明,但这似乎没有问题,因为这是开箱即用的默认设置

未安装Apache,nginx是唯一的服务器

调试:

nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

lsof -i :80

COMMAND  PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   1208     root    7u  IPv4  10246      0t0  TCP *:http (LISTEN)
nginx   1208     root    8u  IPv6  10247      0t0  TCP *:http (LISTEN)
nginx   1209 www-data    7u  IPv4  10246      0t0  TCP *:http (LISTEN)
nginx   1209 www-data    8u  IPv6  10247      0t0  TCP *:http (LISTEN)
nginx   1210 www-data    7u  IPv4  10246      0t0  TCP *:http (LISTEN)
nginx   1210 www-data    8u  IPv6  10247      0t0  TCP *:http (LISTEN)

service nginx stop

lsof -i :80

COMMAND  PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   1208     root    7u  IPv4  10246      0t0  TCP *:http (LISTEN)
nginx   1208     root    8u  IPv6  10247      0t0  TCP *:http (LISTEN)
nginx   1209 www-data    7u  IPv4  10246      0t0  TCP *:http (LISTEN)
nginx   1209 www-data    8u  IPv6  10247      0t0  TCP *:http (LISTEN)
nginx   1210 www-data    7u  IPv4  10246      0t0  TCP *:http (LISTEN)
nginx   1210 www-data    8u  IPv6  10247      0t0  TCP *:http (LISTEN)

service nginx restart
 * Restarting nginx nginx
 ...fail!
错误日志:

2015/05/14 14:58:48 [emerg] 14620#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to [::]:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to [::]:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to [::]:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to [::]:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: bind() to [::]:80 failed (98: Address already in use)
2015/05/14 14:58:48 [emerg] 14620#0: still could not bind()
配置文件: nginx.conf

user www-data;
worker_processes 2;
pid /var/run/nginx.pid;

events {
    worker_connections 2048;
    use epoll;
    multi_accept on;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 10;
    send_timeout 2;
    types_hash_max_size 2048;
    server_tokens off;

    client_max_body_size 5M;
    client_body_buffer_size 256k;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    #access_log /var/log/nginx/access.log;
    access_log off;
    error_log /var/log/nginx/error.log;

    gzip on;
    gzip_disable "msie6";
    proxy_set_header Accept-Encoding "";

    proxy_set_header Connection "";
    proxy_http_version 1.1;

    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 5;
    open_file_cache_errors off;

    reset_timedout_connection on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
可用站点/默认站点

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

    #listen [::]:80 ipv6only=on; # listen for IPv6 only traffic on IPv6 sockets
    #listen 80; # listen also for IPv4 traffic on "regular" IPv4 sockets

    root /usr/share/nginx/html;
    index index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }
}