服务器上的Nginx和PHP都是源码编译安装的,不支持类似以前的nginx(start|restart|stop|reload)了。自己动手丰衣足食。以下脚本应该在RHEL, Fedora,CentOS下都适用。
一、Nginx启动脚本/etc/init.d/nginx
#!/bin/bash
#
# Startup script for Nginx - this script starts and stops the nginxdaemon
#
# chkconfig:
# description:
# processname: nginx
#config:
#pidfile:
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
[ -f /etc/sysconfig/nginx ] && ./etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
start() {
}
stop() {
}
restart() {
}
reload() {
}
force_reload() {
}
configtest() {
}
rh_status() {
}
rh_status_q() {
}
case "$1" in