Free* WordPress site with SSL on AWS EC2 free tier

Status
Not open for further replies.

asi_av

Regular Member
Joined
Oct 17, 2010
Messages
270
Reaction score
47
Time to give back, not sure is the right place to post but here we go..

You need to build website to test new product or low traffic to begin with you can do it with AWS free* tier.

Free* - AWS first 12 months & you still have to pay for domain name.
The SSL is free for ever.

To do it first open (if you dont have one) AWS account, once you have go to: Amazon Market Place
Search for: WordPress Certified by Bitnami

Click: Continue to Configuration.

Change your location if you like, click Continue to Lunch.

Change EC2 Instance Type -> T2.micro (this is free tier server)
Create New Key Pair - you need to login to the Instance.
Create Key Pair -> Name your Key Pair -> click create -> download KeyPairName.pem
go back to lunch page, click refresh next to Key Pair, you will see the new Key Pair you created, choose it -> click lunch

Till AWS finish setup open Putty (download and install if you dont have it) Key Gen -> PuTTYgen
Load the keypair.pem you downloaded (change file type to all file to see the .pem file) -> click OK on Successfully import notice -> Click Save Private Key -> Click OK on no pass warning.
Save your PKK file you need it to login to server.

Go back to your AWS Console , go to EC2 -> on the left panel click Elastic IP -> Allocate New Address -> Allocate -> Save the IP Click close.
Click on your new IP, on top click Action -> Associate Address - > Choose your Instance And Private IP -> click Associate -> Click Close.

Go back to Instances click your Instance you can see Instance info below, make sure you see your Elastic IP.
once your Instance marked click Actions -> Instance Settings -> Get Instance Log -> Scroll down
till you find your WP admin user name and password should look like:

#########################################################################
#
# Setting Bitnami application password to 'YOUR-PASSWORD'
# (the default application username is 'user')
#
# #########################################################################

Save it close the window.

open new browser: goto your elastic ip you will have blank WP install...
yourip/wp-admin and use password you got from the log.

Login with Putty:
Host Name: bitnami@elasticIP
port 22
SSH
Click on + next to SSH Click Auth -> browse to your PKK file (the file you generated before), save it for next time and click open.

Login with WinSCP:
New site -> SFTP
Host Name: elasticIP
User name: bitnami
Advanced -> SSH -> Authentication -> Private Key file -> ok -> Save


ready to change domain name?

Login with SSH to your Instance go to:

/opt/bitnami/apps/wordpress/htdocs/wp-config.php

Replace

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');

with the lines below, remembering to replace the DOMAIN placeholder with the actual domain name you wish to use:

define('WP_SITEURL', 'http://DOMAIN/');
define('WP_HOME', 'http://DOMAIN/');

Setup your Free SSL:

open putty run this commands:

Setup Client:
cd /tmp
curl -s https://api.github.com/repos/xenolf/lego/releases/latest | grep browser_download_url | grep linux_amd64 | cut -d '"' -f 4 | wget -i -
tar xf lego_vX.Y.Z_linux_amd64.tar.gz (file name need to be match to file downloaded previous step)
sudo mv lego /usr/local/bin/lego

Turn Off Services:
sudo /opt/bitnami/ctlscript.sh stop

Setup SSL
sudo lego --email="EMAIL-ADDRESS" --domains="DOMAIN" --domains="www.DOMAIN" --path="/etc/lego" run
(replace the DOMAIN placeholder with the actual domain name)
set server to use new cert:

sudo mv /opt/bitnami/apache2/conf/server.crt /opt/bitnami/apache2/conf/server.crt.old
sudo mv /opt/bitnami/apache2/conf/server.key /opt/bitnami/apache2/conf/server.key.old
sudo mv /opt/bitnami/apache2/conf/server.csr /opt/bitnami/apache2/conf/server.csr.old
sudo ln -s /etc/lego/certificates/DOMAIN.key /opt/bitnami/apache2/conf/server.key
sudo ln -s /etc/lego/certificates/DOMAIN.crt /opt/bitnami/apache2/conf/server.crt
sudo chown root:root /opt/bitnami/apache2/conf/server*
sudo chmod 600 /opt/bitnami/apache2/conf/server*
(replace the DOMAIN placeholder with the actual domain name)

start your server
sudo /opt/bitnami/ctlscript.sh start

Renew cert:

sudo /opt/bitnami/ctlscript.sh stop
sudo lego --email="EMAIL-ADDRESS" --domains="DOMAIN" --path="/etc/lego" renew
sudo /opt/bitnami/ctlscript.sh start


good luck you all...
 
Not bad for people who know what they're doing. Definitely wouldn't recommend for a newbie though - managing the website would be hell if you don't understand how AWS works in comparison to conventional hosting. :)
 
I already seen this very guide posted here a few months ago or is this just my Déjà vu? ;)
 
Sounds like a foreign language!
 
Status
Not open for further replies.
Back
Top