lightsail lamp with wordpress thumbnail

How to setup AWS Lightsail LAMP instance for vanilla WordPress Sites

In this tutorial I will walk you through setting up a basic vanilla WordPress site on a LAMP setup. For those that don’t know, LAMP stands for Linux – Apache – MySQL  – PHP and it’s the most common configuration for Applications like WordPress. On this channel I’ve done video tutorials on setting up Multi-instance WordPress using ServerPilot, RunCloud which are cloud web host management services. Also using Plesk and WHM/Cpanel with their Lightsail Blueprints. All of these provide ways to install multiple WordPress instances on a single Lightsail server or instance. Today we’ll walkthrough a manual way of installing WordPress or actually any other website application just using a LAMP setup. This will be useful for those that don’t want the overhead of a webhost management software like the ones mentioned above.

Steps:

  1. Create lightsail instance with LAMP PHP 7 blueprint (This is Bitnami LAMP stack by the way)
  2. Setup DNS for the domain we’ll be using so it has time to propagate.
  3. Download the Private keys from AWS Account page
  4. Setup Bitvise SSH Client. You can use any other SSH/SFTP program but suggest you use one that has a File manager and SSH both.
  5. Run the following commands to create the directories and assign the necessary permissions. Replace the USERNAME and GROUP placeholders with the same username and group you used when installing the stack. Also replace the domain ‘mukesh.me’ references with your own directory/website.
wget https://wordpress.org/latest.zip -P .
sudo unzip latest.zip -d /opt/bitnami/
sudo mv /opt/bitnami/wordpress /opt/bitnami/mukesh.me
sudo chown -R bitnami:daemon /opt/bitnami/mukesh.me
sudo chmod -R g+w /opt/bitnami/mukesh.me
sudo find /opt/bitnami/mukesh.me -type f -exec chmod 664 {} \;
sudo find /opt/bitnami/mukesh.me -type d -exec chmod 775 {} \;

6. Create and edit the sudo vim /opt/bitnami/apache2/conf/vhosts/mukesh.me-vhost.conf file and add the configuration block shown below ( (remember to replace mukesh.me with your domain) :

<VirtualHost _default_:80>
      ServerName mukesh.me
      ServerAlias www.mukesh.me
      DocumentRoot /opt/bitnami/mukesh.me
     <Directory "/opt/bitnami/mukesh.me">
          Options -Indexes +FollowSymLinks -MultiViews
          AllowOverride All
          Require all granted
     </Directory>
</VirtualHost>

7. Create and edit the sudo vim /opt/bitnami/apache2/conf/vhosts/mukesh.me-https-vhost.conf file and add the configuration block shown below (remember to replace mukesh.me with your domain):

<VirtualHost _default_:443>
	ServerName mukesh.me
	ServerAlias www.mukesh.me
	DocumentRoot /opt/bitnami/mukesh.me
	SSLEngine on
	SSLCertificateFile "/opt/bitnami/apache2/conf/bitnami/certs/server.crt"
	SSLCertificateKeyFile "/opt/bitnami/apache2/conf/bitnami/certs/server.key"
	<Directory "/opt/bitnami/mukesh.me">
		Options -Indexes +FollowSymLinks -MultiViews
		AllowOverride All
		Require all granted
	</Directory>
</VirtualHost>

8. Restart the Apache server:

sudo /opt/bitnami/ctlscript.sh restart apache

You should now be able to access the application at http://SERVER-IP/.

9. Setup WP Database

sudo mysql -u root -p

10. Type the password found in  bitnami_application_password

create database wpdb;

11. Create user

CREATE USER 'wpuser'@'localhost' IDENTIFIED BY '$TGWREGQ$T#$TGRG#$TRAGAG';
grant all privileges on wpdb.* to wpuser@localhost;
quit

12. Create Bitnami SSL Cert and follow the prompts

sudo /opt/bitnami/bncert-tool

Say N to any redirects put in the configuration. Instead you can add redirects in .htaccess

Note that if you intend to put CDN in front of this website then I would suggest not to setup SSL on the server. It seems to complicate the CDN setup.

13. Run the WordPress install by visiting https://yourdomain

All videos tutorials on the website as well as the YouTube channel aim to provide a simplified process for a specific scenario; there could be many different factors and unique use cases you may have. The tutorials may not cover every situation; so treat is as a starting point or learning concept to apply to your unique situations, and consider this inspiration but not prescription or explicit direction.

Scroll to Top