You will need to have installed/created:

Sudo or root access
Apache2
Folder Path Directory
  • Create a virtual host for the website, by copying and renaming the default configuration file in apache
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/(exmaple.co.uk).conf
  • Edit virtual host conf file
sudo nano /etc/apache2/sites-available/(example.co.uk).conf

The config file should look like this in the end:

ServerAdmin webmaster@localhost
DocumentRoot /var/www/(example.co.uk)/html
ServerName (example.co.uk)
ServerAlias (example.co.uk)
  <Directory /var/www/(example.co.uk)/html/>
    AllowOverride All
  </Directory>
ErrorLog ${APACHE\_LOG\_DIR}/error.log
CustomLog ${APACHE\_LOG\_DIR}/access.log combined
  • Enable the virtual hosts
sudo a2ensite (example.co.uk).conf

You will get the message below

Enabling site (example.co.uk).
To activate the new configuration, you need to run:
service apache2 reload
  • Reload apache
sudo service apache2 restart

All done :D

Share on LinkedIn
Share on Reddit