Create A Local Network Test Website For An Existing Repository (Ubuntu 21.04)

To complete this task you should have already created a local network web server. This web server should have a public domain name which points to the web server's private IP address on your local network. The web server's domain name in this example is:

You should choose a domain for your private test website by adding one subdomain to this domain, such as:

This domain should be given a public CNAME record that points to the web server domain.

Setup Git And SSH Permissions

@NOTE 2021_04_26

I am relatively new to GitHub and am learning precisely how to interact with it in different situations. If you want to clone a read-only version of a repository, like we want to in this tutorial, use the HTTPS URL for that repository. There are other more complex ways to accomplish the same result with the SSH URL, but they are not necessary here.

Private Repositories

If your git repository is not public, follow the instructions provided by your git host to give your test web server and user permission to read the repository.

Here are some instructions provided by GitHub:

Create The Website Directory On The Web Server

  • $ ssh

  • I use a folder inside my home directory named www to hold a folder for each website hosted by the web server. In my case, the absolute directory name is /home/mattcalkins/www .

    If the folder doesn't exit, create it:

    $ mkdir ~/www

    Then navigate to it.

    $ $ cd ~/www

  • $ curl -s > install.php && php install.php

  • choose option 1

  • enter your website domain

  • enter the https Git URL for your website repository

Create Database

One of the principles of the Mattifesto Method is using unique identifiers which makes searching and potentially replacing much easier. The database is named "com_mattifesto_webserver3_mattifesto_database" because naming it "mattifesto" would create a name overlap in many places.

  • $ sudo mysql

  • mysql> create database us_mtfs_lt7_yaycomputer_database;

  • mysql> create user 'web'@'localhost' identified with mysql_native_password BY '********';

  • mysql> grant all on us_mtfs_lt7_yaycomputer_database.* to 'web'@'localhost';

  • mysql> flush privileges;

  • mysql> exit;

  • $ mysql -u web -p

  • mysql> show databases;

  • mysql> exit;

Create Virtual Host


  • $ sudo vi /etc/apache2/sites-available/us_mtfs_lt7_yaycomputer.conf

    <VirtualHost *:80>
        DocumentRoot    /home/mattcalkins/www/us_mtfs_lt7_yaycomputer/document_root
        ErrorLog        /home/mattcalkins/www/us_mtfs_lt7_yaycomputer/logs/error.log
        CustomLog       /home/mattcalkins/www/us_mtfs_lt7_yaycomputer/logs/access.log combined
        <Directory "/home/mattcalkins/www/us_mtfs_lt7_yaycomputer/document_root">
            AllowOverride   all
            Require         all granted
    <VirtualHost *:443>
        DocumentRoot    /home/mattcalkins/www/us_mtfs_lt7_yaycomputer/document_root
        ErrorLog        /home/mattcalkins/www/us_mtfs_lt7_yaycomputer/logs/error.log
        CustomLog       /home/mattcalkins/www/us_mtfs_lt7_yaycomputer/logs/access.log combined
        SSLEngine               on
        SSLCertificateFile      /home/mattcalkins/
        SSLCertificateKeyFile   /home/mattcalkins/
        <Directory "/home/mattcalkins/www/us_mtfs_lt7_yaycomputer/document_root">
            AllowOverride   all
            Require         all granted
  • $ sudo a2ensite us_mtfs_lt7_yaycomputer

  • $ sudo apache2ctl configtest

  • $ sudo systemctl reload apache2

Set Up The Website

Option 1: If you are creating a fresh website instance:

  • On your workstation browser, navigate to:

  • MySQL Host: localhost

  • MySQL Username: web

  • MySQL Password: <password>

  • MySQL Database: us_mtfs_lt7_yaycomputer_database

  • Developer Email Address: Use the email address you want to use for your user account on this specific website.

  • Developer Password: Enter the password you want to use for this specific website.

  • Confirm Developer Password: re-enter password

The website will point out a few more steps you will want to take. You will also want to setup an email account so that email services can be used.

2021_04_10 There will be a settings.json file in the document root which should be deleted. There is an issue related to this and the process will be changed to delete this as part of the process.

Option 2: If you are copying another website instance:


  • $ cd www/us_mtfs_lt7_yaycomputer/document_root/

  • $ cp tmp/database-backups/<most recent backup file> tmp/database-backups/import.sql

  • $ vi tmp/database-backups/import.sql

  • :%s/<old_database_name>/us_mtfs_lt7_yaycomputer_database/gc

    This moment is where it really helps if the database names are unique like we mentioned at the beginning of this document.

  • $ mysql -u web -p < tmp/database-backups/import.sql

  • $ vi colby-configuration.php

  • Manually update the constant values for for the new website.

  • On your workstation browser, navigate to:

    Your password is the same as it was for the copied site.

    Go to the update admin page for the website you are copying and click on the "Update Site" button to create the tables that aren't exported in database backups.