代码拉取完成,页面将自动刷新
同步操作将从 PESCMS/tltw lnmp shell 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
echo "请选择您的操作:"
echo "1. 重启Nginx"
echo "2. 重启Mysql"
echo "3. 重启PHP-FPM"
echo "4. 重启LNMP"
echo "5. 启动LNMP"
echo "6. 停止LNMP"
echo "7. 添加新域名"
echo "请输入数字:"
read num
case "$num" in
[1] )
echo '执行关闭Nginx进程...'
/opt/nginx/nginx -s stop
echo '进行重启Nginx...'
/opt/nginx/nginx
echo '已成功重启Nginx!'
;;
[2] )
echo '执行Mysql重启命令...'
/etc/init.d/mysql restart
echo '已成功重启Mysql!'
;;
[3] )
echo '执行关闭php-fpm进程...'
kill -9 `ps -aux | grep php-fpm| awk -F' ' '{print $2}'`
echo '进行重启php-fpm...'
/opt/php/sbin/php-fpm
echo '已成功重启php-fpm!'
;;
[4] )
#执行顺序说明:Nginx执行PHP依赖php-fpm,因此必须先对php-fpm进行重启!
echo '执行关闭php-fpm进程...'
kill -9 `ps -aux | grep php-fpm| awk -F' ' '{print $2}'`
echo '进行重启php-fpm...'
/opt/php/sbin/php-fpm
echo '已成功重启php-fpm!'
echo '执行关闭Nginx进程...'
/opt/nginx/nginx -s stop
echo '进行重启Nginx...'
/opt/nginx/nginx
echo '已成功重启Nginx!'
echo '执行Mysql重启命令...'
/etc/init.d/mysql restart
echo '已成功重启Mysql!'
echo 'LNMP已经成功重启!'
;;
[5] )
echo '启动LNMP中...'
/opt/php/sbin/php-fpm
/opt/nginx/nginx
/etc/init.d/mysql start
echo 'LNMP已经成功启动!'
;;
[6] )
echo '停止LNMP中...'
kill -9 `ps -aux | grep php-fpm| awk -F' ' '{print $2}'`
/opt/nginx/nginx -s stop
/etc/init.d/mysql stop
echo 'LNMP已经停止!'
;;
[7] )
echo "请输入域名"
read domain
echo "是否开启重写[y/n]"
read rewrite
rewriteStr=""
if [ $rewrite = "y" ]
then
rewriteStr="
location ~/ {
if (!-e \$request_filename){
rewrite ^/(.*)\$ /index.php?s=\$1 last;
}
}"
fi
echo "
server {
listen 80;
server_name $domain;
root /var/www/$domain;
index index.html index.htm index.php;
access_log /opt/nginx/log/$domain.access.log;
error_log /opt/nginx/log/$domain.error.log;
location / {
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params;
}
$rewriteStr
}">> /opt/nginx/vhost/$domain.conf
;;
*) echo "没有任何操作,脚本退出";;
esac
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。