Skip to content

Instantly share code, notes, and snippets.

@rraspo
Last active February 6, 2020 02:23
Show Gist options
  • Select an option

  • Save rraspo/ed22899e4c828ec0bc379c807c5d17c9 to your computer and use it in GitHub Desktop.

Select an option

Save rraspo/ed22899e4c828ec0bc379c807c5d17c9 to your computer and use it in GitHub Desktop.
SH to install Laravel LAMP on AWS. Basically a copy-paste from AWS tutorial with composer and mbstring.
sudo yum update -y
sudo yum install -y httpd24 php70 php70-mbstring mysql56-server php70-mysqlnd
sudo service httpd start
sudo chkconfig httpd on
# Check security group allowing http incoming connections - Apache test page should be visible
# Setup www group and future permissions
sudo groupadd www
sudo usermod -a -G www ec2-user
sudo usermod -a -G www apache
sudo chown -R ec2-user:www /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 {} \;
# Test PHP
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
rm /var/www/html/phpinfo.php
# Setup MySql
sudo service mysqld start
sudo mysql_secure_installation
sudo chkconfig mysqld on
# Install composer globally
installComposer
# Composer installation function
function installComposer {
cd
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
}
@rraspo
Copy link
Author

rraspo commented Apr 27, 2017

This will leave a correct setup for Laravel running in Amazon EC2. Don't forget to run 'composer install' and 'php artisan key:generate'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment