Skip to content

Instantly share code, notes, and snippets.

@benbowler
Last active December 28, 2016 15:22
Show Gist options
  • Save benbowler/441796ff25c0b7ea2c68145403233439 to your computer and use it in GitHub Desktop.
Save benbowler/441796ff25c0b7ea2c68145403233439 to your computer and use it in GitHub Desktop.
How to setup Apache and PHP on Amazon Linux (AWS)
#!/bin/sh
# Based on http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Tutorials.WebServerDB.CreateWebServer.html
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
yum update -y
yum install -y httpd24 php56 # php56-mysqlnd
service httpd start
chkconfig httpd on
groupadd www
usermod -a -G www ec2-user
chown -R root:www /var/www
chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} +
find /var/www -type f -exec sudo chmod 0664 {} +
service httpd restart
groups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment