Last active
August 8, 2023 21:14
-
-
Save jeffbrl/04252568bf9ff33c700a32181d3d46b1 to your computer and use it in GitHub Desktop.
AWS EC2 User Data for installing apache on Amazon Linux 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
yum update -y | |
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 `hostname` > /var/www/html/index.html | |
echo '<br><br>' >> /var/www/html/index.html | |
# create ~ 12K of random text | |
base64 /dev/urandom | head -c 1000 >> /var/www/html/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment