Name-based Virtual Host Support

From Da Nerd Mage Wiki
Revision as of 19:07, 1 January 2022 by Tinker (talk | contribs) (Created page with "The Apache web server Can easily be configured to serve up different content based on the '''name''' it was called as. This allows fun stuff like giving your machine multiple names via DNS and making it look like a whole server farm. This also makes life easier if you're using it to proxy for other machines internal to your network. In these notes, we'll be setting up 4 names for the server. '''foo.bar''' & '''www.foo.bar''' which will be the default web site. '''Wiki...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Apache web server Can easily be configured to serve up different content based on the name it was called as.

This allows fun stuff like giving your machine multiple names via DNS and making it look like a whole server farm.

This also makes life easier if you're using it to proxy for other machines internal to your network.

In these notes, we'll be setting up 4 names for the server. foo.bar & www.foo.bar which will be the default web site. Wiki.foo.bar which will be served up by the same install of Apache, but still independant of the default web site. Proxy.foo.bar which is on another machine completely & wouldn't otherwise be reachable.

You will need to set up external DNS for Wiki.foo.bar & Proxy.foo.bar (which are NOT the same as your normal webserver name as far as the outside world is concerned)

NOTE: It is probably smartest 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...

(But, if you really want to, they can simply be added to /etc/apache2/apache2.conf)

A sample set of files for /etc/apache2/sites-available: