Teaching Research and Publishings Speaking Engagements Professional Development About Me

Notice: Undefined variable: connect in /var/www/codeadam.ca/includes/header.php on line 20

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /var/www/codeadam.ca/includes/header.php on line 20

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /var/www/codeadam.ca/includes/header.php on line 22

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /var/www/codeadam.ca/includes/header.php on line 24

Server Setup Documents


Installing Apache, PHP and MySQL

Command Line

Not that you have an instance running we need to configure it as a web server. Most of this will be done through the command line so click on Compute Engine and open up the SSH tool in a browser window:

We need to run all of the commands as the root user so we will need to prefix most command with sudo. Some of the commands will ask for confirmation [y/n], enter y and press enter.


Install Apache

sudo apt-get install apt-utils
sudo apt-get install apache2 apache2-utils
sudo service apache2 restart

At this point your server should be delivering web pages. Visit your external IP address in a browser http://999.999.999.999 to view the default Apache page.


Install PHP

Install PHP and all required libraries:

sudo apt-get install php
sudo apt-get install php-dev php-gd php-pear php-curl
sudo apt-get install php-xmlrpc php-xsl
sudo apt-get install libapache2-mod-php
sudo service apache2 restart

Run the update command:

sudo apt-get update

Install MySQL

sudo apt-get install mysql-server
sudo apt-get install php-mysql mysql-client

Note: Set MySQL root password to something you will remember

Run the update command again:

sudo apt-get update

Install Webmin

And then Install Webmin.


Configure an Apache Virtual Server

Choose a subdomain to do your development with (something.domain.com). Log in to your domain registrar, create an A record for your subdomain, and point it to your Compute Instance public IP address. These steps will be different for each registrar.

Return to Webmin and follow these steps:

  1. Click Servers and then Apache Webservers.

  2. Click Create Virtual Host and use the following settings:

    • Port: 80
    • Document Root: /var/www/something.domain.com
    • Server Name: something.domain.com
  3. Click Create Now.

  4. Click on the Virtual Server link for the new server.

  5. Add AllowOverride All right before the </Directory> and click Save.

  6. Click on Apply Changes (top right).

  7. Click Others and File Manager, navigate to /var/www/something.domain.com and create an index.html file with some testing text in the file.

Visit your subdomain in a browser and you should see your index file.