-
-
Save coquer/a35746a946b4d4edfc8b483984f15e88 to your computer and use it in GitHub Desktop.
AWS Web Server
This file contains hidden or 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
Launch Amazon Linux T2 Micro or T2 Nano instance | |
- Defaults are mostly good, Except select http and admin security groups | |
SSH: | |
ssh -i key.pem [email protected] | |
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html | |
sudo yum update -y | |
# Add git | |
sudo yum install -y git | |
# Add apache | |
sudo yum install -y httpd24 php56 php56-mysqlnd | |
# If you're going to do MySql later: sudo yum install -y mysql55-server | |
sudo service httpd start | |
sudo chkconfig httpd on | |
# Can prove chkconfig using `chkconfig --list httpd | |
# Document root is /var/www/html | |
sudo groupadd www | |
sudo usermod -a -G www ec2-user | |
exit | |
# Re-login so the group membership takes effect | |
# Can prove you're in the group by running `groups` | |
sudo chown -R root: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 {} \; | |
# Can test server by running: | |
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php | |
rm /var/www/html/phpinfo.php | |
# FYI: | |
# sudo service httpd stop|start|restart |
This file contains hidden or 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
sudo yum install -y php56-gd php56-mbstring | |
sudo service httpd restart | |
cd ~ | |
wget https://github.com/impresspages/ImpressPages/archive/master.zip | |
unzip master.zip | |
# If you unzip on accident, this command removes a whole tree: `rm -rf ImpressPages-master` | |
mv ImpressPages-master/* /var/www/html | |
mv ImpressPages-master/.* /var/www/html | |
rmdir ImpressPages-master | |
rm master.zip | |
# Add DB-specific user | |
mysql -u root -p # The following commands are while logged into mysql | |
CREATE USER 'website'@'%' IDENTIFIED BY 'your_strong_password'; | |
CREATE DATABASE impress; | |
GRANT ALL PRIVILEGES ON impress.* TO "website"@"%"; | |
FLUSH PRIVILEGES; | |
exit; | |
# Give Impress Pages the needed file access | |
sudo vim /etc/httpd/conf/httpd.conf # Edit line 151 (The AllowOverride None under Direcotry /var/www/html to be Allow Override All) | |
sudo usermod -a -G www apache | |
sudo service httpd restart | |
# Then visit the website for a setup wizard | |
This file contains hidden or 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
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html | |
(in the IAM section) | |
Create New Group called "Administrators" (with the AdministratorAccess policy) | |
Create IAM users and add to the group | |
In the "dashboard" section, edit the account alias to make *alias*.signin.aws.amazon.com/console | |
On the IAM homepage, finish the 5 security steps | |
(in the EC2 section) | |
Choose Oregon as it's cheaper | |
Create a key pair for each type of servers (like prodfarm, webserver, etc) | |
Remember to `chmod 400 key.pem` | |
Create a VPC called "the-vpc" | |
Leave the "default" security group as-is (It allows traffic between any servers in this group) | |
Add an "http" security group allowing "http" and "https" inbound traffic | |
Add an "admin" security group allowing "All Traffic" from known locations, like your office | |
http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/free-tier-alarms.html | |
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide | |
This file contains hidden or 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
sudo yum install -y mysql55-server | |
sudo service mysqld start | |
sudo mysql_secure_installation # And follow instructions | |
# http://passwordsgenerator.net is good for finding a new root password | |
sudo chkconfig mysqld on | |
# FYI: | |
# sudo service mysqld stop|start|restart | |
# Add phpMyAdmin (for access from a single IP) | |
sudo yum-config-manager --enable epel | |
sudo yum install -y phpMyAdmin | |
sudo sed -i -e 's/127.0.0.1/your_ip_address/g' /etc/httpd/conf.d/phpMyAdmin.conf | |
sudo service httpd restart | |
# Can use phpMyAdmin by visiting the site's /phpmyadmin | |
This file contains hidden or 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
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html | |
# Generally useful | |
sudo usermod -a -G www apache | |
sudo service httpd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment