Nginx Web服务器在进行spawn-fcgi系统启动服务文件的更新的时候有不少需要我们注意的地方,下面我们就看看有关的命令如何编写,希望在之后的Nginx Web服务器工作中有所收获。
- #!/bin/sh
- # chkconfig: - 85 15
- # description: PHP Fast-CGI
- # processname: PHP Fast-CGI
- # pidfile: /var/run/php-cgi.pid
- # Source function library.
- . /etc/rc.d/init.d/functions
- # Source networking configuration.
- . /etc/sysconfig/network
- # Check that networking is up.
- [ "$NETWORKING" = "no" ] && exit 0
- SPAWNFCGI="/usr/local/bin/spawn-fcgi"
- FCGIPROGRAM="/opt/local/php-5.2.10/bin/php-cgi"
- FCGIPID="/var/run/php-cgi.pid"
- FCGIPORT="10005"
- FCGIADDR="127.0.0.1"
- FCGIUSER="www"
- FCGIGROUP="www"
- PHP_FCGI_CHILDREN=200
- ## maximum number of requests a single PHP process can
serve before it is restarted- PHP_FCGI_MAX_REQUESTS=1000
- #
- lockfile=/var/lock/subsys/php-cgi
- prog=$(basename ${FCGIPROGRAM})
- start() {
- echo -n $"Starting $prog: "
- daemon $SPAWNFCGI -f "${FCGIPROGRAM}" -a $FCGIADDR -p
$FCGIPORT -C $PHP_FCGI_CHILDREN -u $FCGIUSER -g $FCGIGROUP
-P $FCGIPID >> /dev/null 2>&1- retval=$?
- echo
- [ $retval -eq 0 ] && touch $lockfile
- return $retval
- }
- stop() {
- echo -n $"Stopping $prog: "
- killproc $prog -QUIT
- retval=$?
- echo
- [ $retval -eq 0 ] && rm -f $lockfile
- return $retval
- }
- restart() {
- stop
- echo -ne "Restart...\n"
- sleep 3
- start
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- *)
- echo $"Usage: $0 {start|stop|restart}"
- RETVAL=1
- esac
以上就是对Nginx Web服务器的相关服务介绍,希望大家有所收获。
【编辑推荐】