Chinaunix首页 | 论坛 | 博客
  • 博客访问: 104227
  • 博文数量: 21
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 223
  • 用 户 组: 普通用户
  • 注册时间: 2016-02-18 09:51
文章分类

全部博文(21)

文章存档

2016年(21)

我的朋友

分类: LINUX

2016-04-22 14:05:59

Nginx报错提示:nginx: [alert] kill(4426, 15) failed (3: No such process)

首先测试配置文件是否正确:

点击(此处)折叠或打开

  1. [root@locahost]# nginx -t
  2. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  3. nginx: configuration file /etc/nginx/nginx.conf test is successful

配置文件是正确的但是我正常启动却报错:

点击(此处)折叠或打开

  1. [root@locahost sbin]# ./nginx -s reload
  2. nginx: [alert] kill(1512, 1) failed (3: No such process)
解决办法:
     启动时指定配置文件       

点击(此处)折叠或打开

  1. root@locahost sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
  2. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
  3. nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)





但是依旧报错 提示:端口已被占用

解决办法:
 

点击(此处)折叠或打开

  1. [root@locahost conf]# ps -ef |grep nginx|cut -c 9-15|xargs kill -9
再次启动

点击(此处)折叠或打开

  1. /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx 显示恢复正常启动;


原因分析:

点击(此处)折叠或打开

  1. [root@locahost conf]# nginx -V
  2. nginx version: nginx/1.0.15
  3. built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
  4. TLS SNI support enabled
  5. 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

以上只是个人理解:如有意见请与我交流


阅读(3638) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~