我正在尝试启动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()
当我运行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
当我尝试kill -9 1
时,它不会出错,但运行ps ax | grep nginx
会得到相同的响应。
我的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;
}
}
}
答案 0 :(得分:0)
不要kill
nginx进程。使用您的端口的netstat -plnt
进程。
调用命令2.4.29-1
并查看谁使用您的端口