V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
kmdd33
V2EX  ›  问与答

求助: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

  •  
  •   kmdd33 · 2018-06-30 20:42:29 +08:00 · 2099 次点击
    这是一个创建于 2339 天前的主题,其中的信息可能已经有所发展或是发生改变。

    站点 ip 突然打不开,求助大家:

    目前 /usr/local/openresty/nginx/logs/error.log

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

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

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

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

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

    然后我执行了:# netstat -antp

    Active Internet connections (servers and established)

    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

    tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 809/nginx: master p

    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 723/sshd

    tcp 0 36 139.162.219.238:22 113.118.253.249:6991 ESTABLISHED 1526/sshd: root@pts

    tcp 0 0 139.162.219.238:22 113.118.253.249:5682 ESTABLISHED 1701/sshd: root@not

    tcp 0 0 139.162.219.238:22 113.118.253.249:6658 ESTABLISHED 1450/sshd: root@not

    tcp 0 0 139.162.219.238:22 113.118.253.249:6492 ESTABLISHED 1407/sshd: root@pts

    tcp 0 0 139.162.219.238:22 113.118.253.249:5817 ESTABLISHED 1211/sshd: root@pts

    tcp6 0 0 :::9000 :::* LISTEN 724/php-fpm: master

    tcp6 0 0 :::3306 :::* LISTEN 941/mysqld

    tcp6 0 0 :::22 :::* LISTEN 723/sshd

    端口被占用了吗这是?按照 google 的教程,尝试 killall -9 nginx 重启依然照旧!

    贴出自己的 nginx.conf:

    user root;

    worker_processes 1;

    #error_log logs/error.log;

    error_log logs/error.log debug;

    #error_log logs/error.log info;

    pid logs/nginx.pid;

    events { worker_connections 1024; }

    http { include mime.types; default_type application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
    #access_log  logs/access.log  main;
    
    sendfile        on;
    #tcp_nopush     on;
    
    #keepalive_timeout  0;
    keepalive_timeout  65;
    
    gzip  on;
    

    #WAF

    lua_shared_dict limit 50m;
    
    lua_package_path "/usr/local/openresty/nginx/conf/waf/?.lua";
    init_by_lua_file "/usr/local/openresty/nginx/conf/waf/init.lua";
    access_by_lua_file "/usr/local/openresty/nginx/conf/waf/access.lua";
    
    
    
    
    
    server {
        listen       80;
        listen [::]:80 ipv6only=on default_server;
        server_name  139.162.219.238;
    
        #charset koi8-r;
    
        #access_log  logs/host.access.log  main;
    
        location / {
            root   html;
            index  index.php index.html index.htm;
        }
    
        #error_page  404              /404.html;
    
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
    
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
           root           html;
           fastcgi_pass   127.0.0.1:9000;
           fastcgi_index  index.php;
           fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
           include        fastcgi_params;
        }
    
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    
    
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;
    
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    
    
    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;
    
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
    
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
    
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
    
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    

    }

    3 条回复    2018-07-02 02:04:40 +08:00
    kmdd33
        1
    kmdd33  
    OP
       2018-06-30 20:48:32 +08:00
    sudo fuser -k 80/tcp 尝试执行这个命令:
    sudo: fuser: command not found
    0312birdzhang
        2
    0312birdzhang  
       2018-07-01 13:36:54 +08:00 via iPhone
    这是我看到你发的第三个贴子了...
    kmdd33
        3
    kmdd33  
    OP
       2018-07-02 02:04:40 +08:00
    @0312birdzhang 解决了,谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5287 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:40 · PVG 17:40 · LAX 01:40 · JFK 04:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.