nginx加载配置invalid PID number错误

 当重载配置时,报进程错误:

# nginx -s reload

nginx: [error] invalid PID number "" in "/var/run/nginx.pid"

由于修改了配置文件的指定,则需使用如下命令,只能nginx配置:

# nginx -c /usr/local/nginx/conf/nginx.conf

但由于修改导致该命名在启动时可能会报:

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

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

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

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

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

nginx: [emerg] still could not bind()

 此时,需找到已经启动的端口的进程,并杀掉:

# netstat -ltunp | grep 3000

tcp        0      0 0.0.0.0:3000            0.0.0.0:*               LISTEN      29786/nginx: master 

# kill -9 29786

最后再指定配置即可:

 # nginx -c /usr/local/nginx/conf/nginx.conf

你可能感兴趣的:(Linux,nginx,运维,linux)