nginx加php(三) 启动脚本
不用nginx默认的方式启动nginx
start_web.sh
#!/bin/bash
USE_FPM=1
USE_HHVM=0
ulimit -HSn 60000
if [ "$USE_FPM" = "1" ]; then
if [ $(ps hf -C php-fpm | wc -l) = "0" ]; then
/sbin/php-fpm --fpm-config /data/app/conf/php-fpm.conf
else
kill -USR2 $(cat /data/app/run/php-fpm.pid)
fi
elif [ "$USE_HHVM" = "1" ]; then
if [ $(ps hf -C hhvm | wc -l) != "0" ]; then
kill $(cat /data/app/run/hhvm/hhvm.pid)
sleep 1
fi
/usr/bin/hhvm -c /etc/hhvm/php.ini -c /data/app/conf/hhvm.ini -m daemon
else
for n in 0 1 2 3 4; do
/data/app/bin/spawn-php.sh $n >/dev/null 2>&1
done
fi
nohup /usr/sbin/cronolog -z Asia/Shanghai /data/app/log/nginx-access-bigdata-%Y%m%d.log < /data/app/log/nginx-fifo-bigdata.log 1>/dev/null 2>/dev/null &
/usr/sbin/nginx -c /data/app/conf/nginx.conf
stop_web.sh
#!/bin/bash
killall nginx php-fpm hhvm php-cgi 2>/dev/null
sleep 1
killall -9 nginx php-fpm hhvm php-cgi 2>/dev/null
sleep 1
rm -f /tmp/php-fastcgi*.sock