Nginx报错提示:nginx: [alert] kill(4426, 15) failed (3: No such process)
首先测试配置文件是否正确:
-
[root@locahost]# nginx -t
-
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
-
nginx: configuration file /etc/nginx/nginx.conf test is successful
配置文件是正确的但是我正常启动却报错:
-
[root@locahost sbin]# ./nginx -s reload
-
nginx: [alert] kill(1512, 1) failed (3: No such process)
解决办法:
启动时指定配置文件
-
root@locahost sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
-
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)
但是依旧报错 提示:端口已被占用
解决办法:
-
[root@locahost conf]# ps -ef |grep nginx|cut -c 9-15|xargs kill -9
再次启动
-
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx 显示恢复正常启动;
原因分析:
-
[root@locahost conf]# nginx -V
-
nginx version: nginx/1.0.15
-
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
-
TLS SNI support enabled
-
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=-Wl,-E
看红色字体,我的nginx在编译安装时已经指定过配置文件的路径了,但是我现在使用的配置文件并不是编译安装时指定的文件,而我/etc/的nginx配置文件里指定过nginx的pid路径的。 所以在./nginx启动的时候nginx有可能会去使用/etc/nginx.conf
以上只是个人理解:如有意见请与我交流
阅读(3918) | 评论(0) | 转发(0) |