一般情况下配置开机自动启动Nginx + PHP + Mysql

vi /etc/rc.local

把下面的内容增加到exit 0的上面

/usr/local/server/mysql/mysql start
/usr/local/server/php/sbin/php-fpm start
/usr/local/servernginx/sbin/nginx

最近VPS频繁访问故障,无法正常访问,问题关键是/etc/rc.local 无法正常启动服务!

其他解决方案如下:

touch /etc/init.d/lnmp.local
vi /etc/init.d/lnmp.local

====================================================

#!/bin/sh

/usr/local/server/mysql/mysql start
/usr/local/server/php/sbin/php-fpm start
/usr/local/servernginx/sbin/nginx

====================================================

//给予文件可执行权限
chmod +x /etc/init.d/lnmp.local

//设置启动级别(必须)
update-rc.d lnmp.local start 99 2 3 4 5 . stop 01 0 1 6 .

如需删除脚本的启动级别可进行如下操作

update-rc.d -f rc.local remove

 

Linux/Unix | 评论(0) | 引用(0) | 阅读(12104)