简体   繁体   English

kill -9不会杀死docker容器中的nginx进程

[英]kill -9 does not kill nginx process in docker container

I am trying to start nginx, when I try and start nginx, I get this error: 我正在尝试启动nginx,当我尝试启动nginx时,出现以下错误:

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]: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 [::]: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 [::]: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 [::]: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 [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

When I run ps ax | grep nginx 当我运行ps ax | grep nginx ps ax | grep nginx I get: 我得到ps ax | grep nginx

    1 ?        Ss     0:00 nginx: master process nginx -g daemon off;
 4042 ?        S      0:00 nginx: worker process
 4063 pts/0    S+     0:00 grep nginx

When I try kill -9 1 it does not error but running ps ax | grep nginx 当我尝试kill -9 1它不会出错,但是运行ps ax | grep nginx ps ax | grep nginx gets the same response. ps ax | grep nginx得到相同的响应。

My nginx.conf looks like this: 我的nginx.conf看起来像这样:

worker_processes 1;

user nobody nogroup;
pid /tmp/nginx.pid;
error_log /tmp/logs/nginx.error.log;

events {
    worker_connections 1024;
    accept_mutex off;
}

http {
    include mime.types;
    default_type application/octet-stream;
    access_log /tmp/logs/nginx.access.log combined;
    sendfile on;

    server {
        proxy_http_version 1.1; # this is essential for chunked responses to work

        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default ipv6only=on; ## listen for ipv6
        client_max_body_size 4G;
        server_name _;


        gzip on;
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types application/javascript text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        keepalive_timeout 5;

        location /cutting/  {
            alias /cutting/;
        }

        location  / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;

            # UNCOMMENT LINE BELOW IF THIS IS BEHIND A SSL PROXY
            #proxy_set_header X-Forwarded-Proto https;

            proxy_redirect off;
            proxy_pass   http://localhost:8000;
        }
    }
}

Don't kill nginx process. 不要kill nginx进程。 kill process that use your port. kill使用您的端口的进程。 Call command netstat -plnt and see who use your port 调用命令netstat -plnt并查看谁使用您的端口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM