ufw allow 'Apache Full'
# required for speedtest html
apt install apache2 php libapache2-mod-php
##mod
sudo a2enmod ssl
sudo a2enmod proxy
sudo a2enmod proxy_wstunnel
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo a2enmod headers
# 监控进程crontab
* * * * * /bin/bash apachedamon.sh
#监控进程
#!/bin/bash
# Apache httpd进程监控shell
# 如果你在使用RHEL / CentOS / Fedora Linux,使用这个重启命令
#RESTART="/sbin/service httpd restart"
# 如果你在使用 Debian / Ubuntu Linux,把上面的RHEL的注释掉,换用这个
RESTART="/etc/init.d/apache2 restart"
#path to pgrep command
PGREP="/usr/bin/pgrep"
# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2
#HTTPD="httpd"
# Debian / Ubuntu Linux 下进程名是apache2
HTTPD="apache2"
# find httpd pid
$PGREP ${HTTPD}
if [ $? -ne 0 ] # if apache not running
then
echo "restart"
$RESTART # restart apache
fi