阿里云服务器配置 Lamp 及项目上线
部署 LAMP (CentOS 7.2)
配置 apache 开机自启动
1. 复制路径
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
2. 添加 httpd 服务
chkcong --add httpd
3. 设置开机启动
chkcong httpd on
可能遇见错误:
解决方法:
打开 vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh 下面)
#chkcong: 2345 10 90
#description: Activates/Deactivates Apache Web Server
加上上面这两行就可以,#必须有
其中:2345 是设为要启动的运行级别,10 是启动优先级,90 是杀死进程的优先级,
谁优先谁先挂的意思。
4. 设置 apache 和 mysql 开机启动
chkcong httpd on
chkcong mysqld on
5. 重启后 apache 和 mysql 完成开机自启动。
配置计划任务:
1. 开机自启动
systemctl enable crond.service
2. 启动
/bin/systemctl start crond.service
停止
/bin/systemctl stop crond.service
重启
/bin/systemctl restart crond.service
查看状态