06. Setting up virtual hosts - findsorguk/findsorguk GitHub Wiki

On a public webserver

A default non -ssl configuration is available in the vHostsConfig repo. To get this onto your machine:

cd /etc/apache2/sites-available
sudo wget https://raw.githubusercontent.com/findsorguk/vhostsConfigs/blob/master/finds.org.uk.conf

Make changes for hostname as appropriate:

sudo nano finds.org.uk.conf

Then enable the config:

sudo a2ensite finds.org.uk
sudo service apache2 reload
sudo service apache2 restart

If you want to use SSL

cd /etc/apache2/sites-available
sudo wget https://raw.githubusercontent.com/findsorguk/vhostsConfigs/master/https-finds.org.uk.conf
sudo a2ensite https-finds.org.uk 

You need to turn on SSL within your config file:

sudo nano app/config/application.ini

You will then need to change the entry that looks like this:

ssl.modules.require_ssl = 'all';

On a local machine

A default non -ssl configuration is available in the vHostsConfig repo. To get this onto your machine:

cd /etc/apache2/sites-available
sudo wget https://github.com/findsorguk/vhostsConfigs/blob/master/finds.org.uk.conf

Add a hostname that you want to send the site to on your box (ServerName).

sudo nano finds.org.uk.conf

Then find the ip address of your machine (either localhost or the ip address of your virtual machine), and edit /etc/hosts

sudo nano /etc/hosts

Add the entry for your host:

127.0.0.1     domain you chose

For example:

127.0.0.1     finds.dev

Then enable and restart apache:

sudo a2ensite finds.org.uk
sudo service apache2 reload
sudo service apache2 restart

Moving on, we now need some users, so that is the next step.