Deploy the site

Assuming that a virtual server has been deployed and configured (see previous guides), we will now upload our application onto it. For the purpose of this guide, we will:


We will use FileZilla to upload the site files from our home computer to the server. To do this, we first need to set up access to our server within FileZilla.

Install FileZilla and create the .ppk key file.

  1. Use the Software Center to install FileZilla on your computer
  2. Open the program
  3. On the left side, you will see a file explorer type screen for your own computer. On the right side, it will say "Not connected to any server"
  4. From the menu, choose Edit - Settings...
  5. Choose "SFTP" from the menu, then click on "Add keyfile..."
  6. You will see a screen asking you to choose the keyfile. Browse to the place where you stored "my-key-pair.pem" (the AWS private key)
  7. You will see a pop-up asking you to convert the .pem file into a supported format (.ppk). Click "Yes"
  8. You will see a Save screen. Browse to the same folder as your .pem file, under Name at the top enter "my-key-pair", then click "Save"
  9. You will be back in the Settings screen. Click "OK" to return to the main screen

Define the site.

  1. From the menu, choose File - Site Manager...
  2. Click "New Site"
  3. Name the new site "MyServer1"
  4. On the right side, under Host, enter the Elastic IP
  5. From the Protocol dropdown, select "SFTP - SSH File Transfer Protocol"
  6. From the Logon Type dropdown, select "Interactive"
  7. Under User, enter "ubuntu"
  8. Click "Connect"
  9. Now you should be back in the main screen, and the contents of /home/ubuntu on the server should be visible on the right-hand side

Copy the website files

Create the root directory for the website. This will hold all the database and website files.

  1. Using the terminal, SSH into the server if you haven't already: ssh -i /path/to/my-key-pair.pem ubuntu@{Elastic IP}
  2. mkdir /home/ubuntu/techclub

Copy the files from your computer.

  1. In FileZilla, browse on the left side to the root folder of the website
  2. Click on the right side and hit F5 to refresh the listing so you can see the new techclub folder, then double-click on the new folder to navigate into it
  3. On the left side, select the app folder, right-click, and select "Upload"
  4. The files will be copied to the server

Change the config settings for the website

The website file needs to be adapted when it is copied to a new machine.

  1. sudo vi /home/ubuntu/techclub/app/frontend/includes/
  2. Change the value of "debug" to false
  3. Change the value of "path_app" to '/home/ubuntu/techclub/app/frontend/'
  4. Change the value of "path_url" to ''
  5. Change the value of "pg_pw" to the server's postgres password from KeePass2
  6. Change the value of "pg_db" to techclub

Create and initialize the database

We need to create the live database.

  1. SSH in to the server using port forwarding, as described previously
  2. In pgAdmin, open the server
  3. Create a new database called "techclub"
  4. Follow the initialization and currency/fee_structure steps in Load database locally
  5. Add the admin user using the method shown there, but change the details to a real name and email

Apache configuration

Create the main Virtualhost for our site by copying the default Virtualhost then modifying it.

  1. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/
  2. sudo vi /etc/apache2/sites-available/
  3. Comment in the ServerName line, and then change the value to
  4. Change the value of ServerAdmin to your email address
  5. Change the value of DocumentRoot to /home/ubuntu/techclub/app/frontend/www
  6. Add a new line under DocumentRoot: FallbackResource /index.php
  7. Leave a space, then add another new line: <Directory /home/ubuntu/techclub/app/frontend/www>
  8. Below than, another new line and indented: Options Indexes FollowSymLinks
  9. Below than, another new line and indented: AllowOverride None
  10. Below than, another new line and indented: Require all granted
  11. Then finally close it off with: </Directory>

Create a Virtualhost which redirects "" to "". There should only be a single, defined URL for our site, both for ease of development and to avoid being penalised by search engines.

  1. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/
  2. sudo vi /etc/apache2/sites-available/
  3. Comment in the ServerName line, and then change the value to
  4. Add a new line under ServerName: Redirect permanent /

Enable the new site and the redirect, then restart Apache.

  1. sudo a2ensite
  2. sudo a2ensite
  3. sudo apache2ctl restart

Release the site to the internet

To release the site, we do the following:

  1. Log into the configuration management screen of whichever ISP we bought the domain name from. The exact screens will obviously vary for each ISP, but the functionality needed is the same
  2. Go to the DNS management screen of the domain
  3. Edit the A-record of the domain to point at the AWS elastic IP
  4. In the AWS security group inbound rules, make sure HTTP is available to everybody, not just your IP
  5. The site is now live, give or take a few minutes (they say it could take hours, but for me it's always worked pretty much immediately)
  6. Immediately test all functionality and security features
  7. Test with and without www, so we are sure the Apache redirect is working
  8. Test responsiveness on your phone and your tablet, and on your phone, don't use Wifi, see how long the pages take to load using the mobile network

comments powered by Disqus