User Tools

Site Tools


apache

Apache

Example Virtual Host

This should be created in /etc/apache2/sites-available/opensource.glasgow.social.conf:

<VirtualHost *:80>
        ServerName opensource.glasgow.social

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/opensource

        ErrorLog ${APACHE_LOG_DIR}/opensource.glasgow.social-error.log
        CustomLog ${APACHE_LOG_DIR}/opensource.glasgow.social-access.log combined

</VirtualHost>

It can then be enabled with:

cd /etc/apache2/sites-available/
sudo a2ensite glasgow.opensource.social

Now we can use certbot to generate Let's Encrypt certificates and get SSL working on this new domain:

sudo apt install certbot
sudo certbot

It'll ask you which domain you want to generate a certificate for. You can add the following line to the apache config (just under ServerName) if you want to also get the www. version of the site working:

     ServerAlias www.opensource.glasgow.social
apache.txt · Last modified: 2021/09/22 19:18 by admin