5,337
edits
No edit summary |
|||
Line 8: | Line 8: | ||
</VirtualHost> | </VirtualHost> | ||
</pre> | </pre> | ||
{{hidden | Full VirtualHost | | |||
The following virtual host has an HTTPS redirect and uses an LetsEncrypt ssl certificate | |||
<pre> | |||
# contents of /etc/apache2/sites-available/davidl.me | |||
<VirtualHost *:80> | |||
ServerName www.davidl.me | |||
ServerAlias davidl.me | |||
ServerSignature Off | |||
RewriteEngine on | |||
RewriteCond %{SERVER_NAME} =www.davidl.me [OR] | |||
RewriteCond %{SERVER_NAME} =davidl.me | |||
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] | |||
</VirtualHost> | |||
<IfModule mod_ssl.c> | |||
<VirtualHost *:443> | |||
ServerName www.davidl.me | |||
ServerAlias davidl.me | |||
ServerSignature Off | |||
ServerAdmin webmaster@localhost | |||
DocumentRoot /var/www/davidl_me/public | |||
ErrorLog ${APACHE_LOG_DIR}/davidlme_error.log | |||
CustomLog ${APACHE_LOG_DIR}/davidlme_access.log combined | |||
Include /etc/letsencrypt/options-ssl-apache.conf | |||
SSLCertificateFile /etc/letsencrypt/live/www.davidl.me/fullchain.pem | |||
SSLCertificateKeyFile /etc/letsencrypt/live/www.davidl.me/privkey.pem | |||
</VirtualHost> | |||
</IfModule> | |||
</pre> | |||
}} | |||
==Compression== | ==Compression== |