Show Advanced KnowledgeHide Advanced KnowledgeConfigure vhosts
General server settings to activate SSL
- Check, which sites are running under https:
ls /etc/apache2/sites-enabled
- Disable all SSL-confs (recommended). Example:
a2dissite 000-default.conf
- Check again if folder is empty. Otherwise delete the content:
rm /etc/apache2/sites-enabled/*
- Now we create all vhost-files that we need. In this case:
cd /etc/apache2/sites-available
- For the whole site:
touch 000-bbs-ilias.conf
- For Etherpad:
touch pad.bbs-ilias.conf
- For ILIAS-Chat-System:
touch chat.bbs-ilias.conf
- If you don`t use similar vhost files allready, you can choose my examples. Just edit some lines so it will fit to your installation:
nano 000-bbs-ilias.conf
- Copy the code below and change the first 10 lines accordingly to your needs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | <VirtualHost bbs-ilias.de:80> ServerAdmin admin@bbs-ilias.de ServerName www.bbs-ilias.de ServerAlias www.bbs-ilias.de ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/access.log combined KeepAlive off HostNameLookups off Protocols h2 http/1.1 <IfModule mod_headers.c> Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains" </IfModule> DocumentRoot /var/www/html #Or its this path? #DocumentRoot /var/www XSendFilePath /var/www/html XSendFilePath /opt <Directory /var/www/html/> <IfModule mod_php7.c> php_flag register_globals off </IfModule> Options -Indexes +FollowSymlinks DirectoryIndex index.php DirectoryIndex index.html DirectoryIndex index.htm AllowOverride All Require all granted </Directory> </VirtualHost> |
|
nano pad.bbs-ilias.conf
- Copy the code below:
- Change the first line and line 20, if necessary
- Also try 127.0.0.1 instead of localhost, of it does not work
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <VirtualHost pad.bbs-ilias.de:80> LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so ProxyVia On ProxyRequests Off ProxyPass / http://localhost:9001/ ProxyPassReverse / http://localhost:9001/ ProxyPreserveHost on <Proxy *> Options FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Proxy> </VirtualHost> |
|
nano chat.bbs-ilias.conf
- Copy the code below
- Change the first line and line 21, if necessary
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <VirtualHost chat.bbs-ilias.de:80> LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so ProxyVia On ProxyRequests Off ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ ProxyPreserveHost on <Proxy *> Options FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Proxy> </VirtualHost> |
a2ensite 000-bbs-ilias.conf
a2ensite pad.bbs-ilias.conf
a2ensite chat.bbs-ilias.conf
systemctl restart apache2
Install the SSL-Certificate with Certbot
apt install certbot python3-certbot-apache
- After the prompt "which names would you like to activate HTTPS for?" , choose the names, like 1 2 3 4, give your e-mail and so on ...
- Choose for the domain bbs-ilias.de also www.bbs-ilias.de
- Recommended: Choose 2: "Secure - Make all requests redirect to secure HTTPS access"
- After all, there should appear something like this:
- "Congratulations! You have successfully enabled https://bbs-ilias.de,https://chat.bbs-ilias.de, https://pad.bbs-ilias.de, and https://www.bbs-ilias.de"
- Check, if everything works like expected: https://bbs-ilias.de ("It works!" should appear))
If you get such error message, pause for some hours and try again. It means, that the DNS servers are not allready in sync:
"... To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address. Additionally, please check that your computer has a publicly routable IP address and that no firewalls are preventing the server from communicating with the client. If you're using the webroot plugin, you should also verify that you are serving files from the webroot path you provided. - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal."