LNMP分离部署
Posted bixiaoyu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LNMP分离部署相关的知识,希望对你有一定的参考价值。
环境:
mysql:192.168.2.151
【Nginx】
yum install -y pcre-devel openssl-deve popt-devel
tar zxvf nginx-1.11.2.tar.gz -C /usr/src/
cd /usr/src/
d /usr/src/nginx-1.11.2/
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
nginx -t
[[email protected] ~]# cat /etc/init.d/nginx #!/bin/bash PRIF="/usr/local/nginx/sbin/nginx" PROG="/usr/local/nginx/logs/nginx.pid" case $1 in start) [[ `netstat -anput | grep nginx | wc -l` -eq 0 ]] $PRIF ([ `echo $?` -eq 0 ] && echo "This Start Secusses!") ||(echo "This Nginx Running,Please reload or restart") ;; stop) [[ `netstat -anput | grep nginx | wc -l` > 0 ]] kill -s QUIT $(cat $PROG) ([ `echo $?` -eq 0 ] && echo "Nginx stop successfully!") || (echo "Failed stop nginx!") ;; reload) if [[ `netstat -anput | grep nginx | wc -l` > 0 ]];then kill -s HUP $(cat $PROG) else $PRIF kill -s HUP $(cat $PROG) ([ `echo $?` -eq 0 ] && echo "This is Nginx reload Secussed!")|| (echo "This Nginx Reload failure!") fi ;; restart) if [[ `netstat -anput | grep nginx | wc -l` == 0 ]];then echo "This Nginx Running..." $PRIF ([ `echo $?` -eq 0 ] && echo "Nginx start successfully!") else echo Stopping Nginx... kill -s QUIT $(cat $PROG) $PRIF ([ `echo $?` -eq 0 ] && echo "This is Nginx Restart Secussed!") || (echo "This Nginx Restart Faulure!") fi ;; *) echo -e "