User Tools

Site Tools


apache

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
apache [2021/09/22 18:44]
admin created
apache [2021/09/22 19:18] (current)
admin [Example Virtual Host]
Line 2: Line 2:
  
 ==== Example Virtual Host ===== ==== Example Virtual Host =====
 +This should be created in ''/​etc/​apache2/​sites-available/​opensource.glasgow.social.conf'':​
 +<​code>​
 <​VirtualHost *:80> <​VirtualHost *:80>
-        ServerName ​coding.openguide.co.uk+        ServerName ​opensource.glasgow.social
  
         ServerAdmin webmaster@localhost         ServerAdmin webmaster@localhost
-        DocumentRoot /var/www/coding+        DocumentRoot /var/www/opensource
  
-        ErrorLog ${APACHE_LOG_DIR}/​error.log +        ErrorLog ${APACHE_LOG_DIR}/​opensource.glasgow.social-error.log 
-        CustomLog ${APACHE_LOG_DIR}/​access.log combined +        CustomLog ${APACHE_LOG_DIR}/​opensource.glasgow.social-access.log combined
- +
-        #Alias /wiki /​usr/​share/​dokuwiki+
  
 </​VirtualHost>​ </​VirtualHost>​
 +</​code>​
 +
 +It can then be enabled with:
 +
 +<code bash>
 +cd /​etc/​apache2/​sites-available/​
 +sudo a2ensite glasgow.opensource.social
 +</​code>​
 +
 +Now we can use certbot to generate Let's Encrypt certificates and get SSL working on this new domain:
 +
 +<code bash>
 +sudo apt install certbot
 +sudo certbot
 +</​code>​
 +
 +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:
  
 +<​code>​
 +     ​ServerAlias www.opensource.glasgow.social
 +</​code>​
apache.1632332682.txt.gz · Last modified: 2021/09/22 18:44 by admin