亲测说明: Centos6下运行没问题.Centos7下配置完成启动没问题,停止不行(暂未处理)
1.添加nginx启动脚本
[root@localhost ~]# vim /etc/init.d/nginx
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/webserver/nginx/sbin/nginx #改为你的ngxin安装目录下启动文件位置
nginx_config=/usr/local/webserver/nginx/conf/nginx.conf #改为你的ngxin的配置文件位置
nginx_pid=/usr/local/webserver/nginx/nginx.pid #改为你的nginx进程所在的位置
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit