Skip to content

Instantly share code, notes, and snippets.

@atulkamble
Created September 10, 2023 13:34
Show Gist options
  • Save atulkamble/291c1465343b07ea9157c78626212f34 to your computer and use it in GitHub Desktop.
Save atulkamble/291c1465343b07ea9157c78626212f34 to your computer and use it in GitHub Desktop.
webserver

Add following Custom data tab of EC2 Configuration | Advanced

Launching EC2 Webserver | httpd

!/bin/bash 
yum update -y 
yum install -y httpd 
systemctl start httpd 
systemctl enable httpd 
chmod 777 /var/www/html/ 
echo "<h1> hello from $(hostname -f)
</h1>">/var/www/html/index.html

Launching Php Webserver on EC2

#!/bin/bash
yum update -y
yum install httpd -y
yum install php -y
service httpd start
service httpd enable
chown -R ec2-user:apache /var/www
chmod 2775 /var/www
cd
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment