Difference between revisions of "WebServer - Name-based Virtual Host Support"

From The TinkerNet Wiki
Jump to navigation Jump to search
(Created page with "(i.e.: moving it from test.tinkernow.net/wiki to wiki.tinkernow.net)<br> <code>sudo vim /var/www/LocalSettings.php</code> *<code>#$wgServer = "http://test.tinkernow.net";</co...")
 
Line 13: Line 13:
 
  </VirtualHost>
 
  </VirtualHost>
 
   
 
   
  <VirtualHost *:80 *:443>
+
  <VirtualHost *:80>
 +
    ServerName wiki.tinkernow.net
 +
    Redirect permanent / <nowiki>https://wiki.tinkernow.net/</nowiki>
 +
</VirtualHost>
 +
 +
<VirtualHost _default_:443>
 
     ServerName wiki.tinkernow.net
 
     ServerName wiki.tinkernow.net
 
     DocumentRoot "/var/www/wiki"
 
     DocumentRoot "/var/www/wiki"
 
  </VirtualHost>
 
  </VirtualHost>
 
   
 
   
  <VirtualHost *:80 *:443>
+
  <VirtualHost *:80>
 +
    ServerName labnotes.tinkernow.net
 +
    Redirect permanent / <nowiki>https://labnotes.tinkernow.net/</nowiki>
 +
</VirtualHost>
 +
 +
<VirtualHost _default_:443>
 
     ServerName labnotes.tinkernow.net
 
     ServerName labnotes.tinkernow.net
 
     DocumentRoot "/var/www/labnotes"
 
     DocumentRoot "/var/www/labnotes"
 
  </VirtualHost>
 
  </VirtualHost>
 
   
 
   
  <VirtualHost *:80 *:443>
+
  <VirtualHost *:80>
 +
    ServerName blog.tinkernow.net
 +
    Redirect permanent / <nowiki>https://blog.tinkernow.net/</nowiki>
 +
</VirtualHost>
 +
 +
<VirtualHost _default_:443>
 
     ServerName blog.tinkernow.net
 
     ServerName blog.tinkernow.net
 
     DocumentRoot "/var/www/WP"
 
     DocumentRoot "/var/www/WP"

Revision as of 15:55, 11 June 2020

(i.e.: moving it from test.tinkernow.net/wiki to wiki.tinkernow.net)
sudo vim /var/www/LocalSettings.php

Then add this to /etc/apache2/apache2.conf

<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/
</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/
</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/
</VirtualHost>

<VirtualHost _default_:443>
    ServerName blog.tinkernow.net
    DocumentRoot "/var/www/WP"
</VirtualHost>

and restart Apache: sudo service apache2 restart