Setting up Apache using ec2 userdata and an attempt at a OS based firewall
Sometimes other things get in the way.
userdata
#!/bin/bash
yum install -y httpd
systemctl start httpd
systemctl enable httpd
usermod -a -G apache ec2-user
chown -R ec2-user:apache /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} \;
find /var/www -type f -exec chmod 0664 {} \;
echo "Good Job" **NOT ALLOWED** /var/www/html/index.html
Command History
[ec2-user@ip-172-31-16-116 ~]$ history
1 sudo netstat -tnlp
2 sudo yum -y install firewalld
3 firewall-cmd -state
4 firewall-cmd --state
5 firewall-cmd --list-all
6 systemctl start firewalld
7 sudo systemctl start firewalld
8 firewall-cmd --list-all
9 firewall-cmd --state
10 sudo firewall-cmd --state
11 sudo firewall-cmd --list-all
12 sudo firewall-cmd --zone=public --add-service http
13 sudo firewall-cmd --list-all
14 sudo firewall-cmd --zone=public --permanent --add-service http
15 sudo systemctl stop firewalld
16 sudo firewall-cmd --list-all
17 history