Difference between revisions of "WebServer - Name-based Virtual Host Support"
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
Then add this to <code>/etc/apache2/apache2.conf</code> | Then add this to <code>/etc/apache2/apache2.conf</code> | ||
+ | |||
+ | <big>'''NOTE:''' It is probably smarter to put the <code>VirtualHost</code> sections in separate files in the <code>/etc/apache2/sites-available/</code> folder, then make symbolic links to them in <code>/etc/apache2/sites-enabled</code> This will simplify maintenance down the road...</big> | ||
<VirtualHost *:80 *:443> | <VirtualHost *:80 *:443> | ||
# This first-listed virtual host is also the default for *:80 | # This first-listed virtual host is also the default for *:80 | ||
Line 50: | Line 52: | ||
and restart Apache: | and restart Apache: | ||
− | * <code>sudo service apache2 restart</code> | + | *<code>sudo service apache2 restart</code> |
Revision as of 14:06, 28 June 2020
This page was created while splitting my original webserver from a single name to 3 names to make access easier. I moved the wikis to their own subdomains. At some point, I really should clean this page up to make it clearer...
(i.e.: moving it from test.tinkernow.net/wiki to wiki.tinkernow.net)
sudo vim /var/www/LocalSettings.php
#$wgServer = "http://test.tinkernow.net";
$wgServer = "http://wiki.tinkernow.net";
Then add this to /etc/apache2/apache2.conf
NOTE: It is probably smarter to put the VirtualHost
sections in separate files in the /etc/apache2/sites-available/
folder, then make symbolic links to them in /etc/apache2/sites-enabled
This will simplify maintenance down the road...
<VirtualHost *:80 *:443> # This first-listed virtual host is also the default for *:80 ServerName test.tinkernow.net # ServerAlias tinkernow.net DocumentRoot "/var/www/html" </VirtualHost> <VirtualHost *:80> ServerName wiki.tinkernow.net Redirect permanent / https://wiki.tinkernow.net/ # This line causes http requests to be converted to https... </VirtualHost> <VirtualHost _default_:443> ServerName wiki.tinkernow.net DocumentRoot "/var/www/wiki" </VirtualHost> <VirtualHost *:80> ServerName labnotes.tinkernow.net Redirect permanent / https://labnotes.tinkernow.net/ # This line causes http requests to be converted to https... </VirtualHost> <VirtualHost _default_:443> ServerName labnotes.tinkernow.net DocumentRoot "/var/www/labnotes" </VirtualHost> <VirtualHost *:80> ServerName blog.tinkernow.net Redirect permanent / https://blog.tinkernow.net/ # This line causes http requests to be converted to https... </VirtualHost> <VirtualHost _default_:443> ServerName blog.tinkernow.net DocumentRoot "/var/www/WP" </VirtualHost>
and restart Apache:
sudo service apache2 restart