sudo yum install -y php
sudo yum install -y php-zip php-xml php-gd
sudo yum install -y httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo usermod -a -G apache ec2-user
ec2-user = your username
after this exit and login back
After logining back
sudo chown -R ec2-user:apache /var/www
sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;
find /var/www -type f -exec sudo chmod 0664 {} \;
sudo yum install -y mod_ssl
sudo wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/
sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm
sudo yum-config-manager --enable epel*
Edit the main Apache configuration file, /etc/httpd/conf/httpd.conf. Locate the "listen 80" directive and add the following lines after it, replacing the example domain names with the actual Common Name and Subject Alternative Name (SAN) to configure:
sudo nano /etc/httpd/conf/httpd.conf
then use this template
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName "example.com"
ServerAlias "www.example.com"
</VirtualHost>
sudo systemctl restart httpd
sudo yum install -y certbot python2-certbot-apache
sudo certbot
follow on screen instructions
use your EMAIL when asked for email
sudo systemctl restart httpd
open /etc/crontab and paste
sudo nano /etc/crontab
39 1,13 * * * root certbot renew --no-self-upgrade
sudo systemctl restart crond
sudo nano /etc/php.ini
upload_max_filesize = 20M
post_max_size = 28M
memory_limit = -1
sudo nano /etc/httpd/conf/httpd.conf
replace line of AllowOverride from AllowOverride All
sudo systemctl restart httpd
sudo systemctl start httpd
sudo systemctl stop httpd