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

2018-06-30 20:42:29 +08:00
 kmdd33

站点 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;
#    }
#}

}

2106 次点击
所在节点    问与答
3 条回复
kmdd33
2018-06-30 20:48:32 +08:00
sudo fuser -k 80/tcp 尝试执行这个命令:
sudo: fuser: command not found
0312birdzhang
2018-07-01 13:36:54 +08:00
这是我看到你发的第三个贴子了...
kmdd33
2018-07-02 02:04:40 +08:00
@0312birdzhang 解决了,谢谢

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/467121

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX