ada recommended color contrast radios be damned

Apache Virtual Hosts On Ubuntu

Apache is a free, open source web server software that powers around two-thirds of all websites in the world – and about a third of all websites are running WordPress.

The post walks you through the process of installing the Apache software and setting up Apache virtual hosts so that you can run more than one website on the same server.

Setting Up Apache Virtual Hosts On Ubuntu

SSH into the web server with an SSH key pair:

ssh -i ~/.ssh/supernifty supernifty@ RETURN

Get a list of updates for all the software that’s currently installed on the server:

sudo apt update RETURN

Install the Apache web server software:

sudo apt install apache2 RETURN

Create public html directories for each site:

sudo mkdir -p /var/www/ RETURN

sudo mkdir -p /var/www/ RETURN

This is where all your website files will reside.

Change the ownership to everything in the /var/www directory to your own user so that all the permissions for everything you’re about to create are set properly:

sudo chown -R supernifty:supernifty /var/www RETURN

Create a placeholder html file for each site so that when someone visits the site with a web browser before you’ve set up the actual website they won’t get an error:

echo ‘future home of’ > /var/www/ RETURN

echo ‘future home of’ > /var/www/ RETURN

Dupe the default Apache config file. It’s faster than retyping everything:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/ RETURN

Open the nano text editor to edit the newly duped config file:

sudo nano /etc/apache2/sites-available/ RETURN

and make your file look something like this:

<VirtualHost *:80>
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Once you’ve finished editing, save your changes and exit the nano text editor by hitting CONTROL-O RETURN and CONTROL-X

Dupe the edited config out to the other domain:

sudo cp /etc/apache2/sites-available/ /etc/apache2/sites-available/ RETURN

and edit the duped config file for the second domain name, in this case just replacing all instances of with

Enable the config file for each site:

sudo a2ensite RETURN

sudo a2ensite RETURN

Disable the default Apache config:

sudo a2dissite 000-default.conf RETURN

Restart Apache for your changes to take effect:

sudo systemctl restart apache2 RETURN

Once you’ve completed the steps above and have pointed your domains at your server’s IP address at your domain registrar, you should see the ‘future home of’ and ‘future home of’ text you created in the placeholder html files when you visit your domains in a web browser.

Now it’s time to install SSL certificates with CertBot.