VirtualHost: Difference between revisions

m
(→‎httpd.conf File: Adding more instructions)
m (→‎httpd.conf File: Formatting)
Line 15: Line 15:


To break down this example directive line by line:
To break down this example directive line by line:
 
*'''<VirtualHost *>''' says the following is going to be a VirtualHost.  The asterisk denotes any connection.  If you wanted to limit the VirtualHost to just port 80 (the default HTTP port) you would instead type '<VirtualHost *:80>'.
'''<VirtualHost *>''' says the following is going to be a VirtualHost.  The asterisk denotes any connection.  If you wanted to limit the VirtualHost to just port 80 (the default HTTP port) you would instead type '<VirtualHost *:80>'.
*'''ServerAdmin webmaster@example.com''' assigns an administrator email address to the domain.
 
*'''DocumentRoot /www/example/foobar/''' specifies the path to the document root.  The domain you're setting up will point to this directory of the server.
'''ServerAdmin webmaster@example.com''' assigns an administrator email address to the domain.
*'''ServerName foobar.example.com''' is the domain name to use.  Obviously, the domain must first be pointed to the Uniform Server.
 
*'''ErrorLog logs/foobar-error_log''' and '''CustomLog logs/foobar-access_log common''' specify where error log files will be saved.  You can put any directory you want, but a relativly logical naming convention is to put the (sub)domain before the title of the log, as done in this example.
'''DocumentRoot /www/example/foobar/''' specifies the path to the document root.  The domain you're setting up will point to this directory of the server.
*'''</VirtualHost >''' ends the VirtualHost directive.
 
'''ServerName foobar.example.com''' is the domain name to use.  Obviously, the domain must first be pointed to the Uniform Server.
 
'''ErrorLog logs/foobar-error_log''' and '''CustomLog logs/foobar-access_log common''' specify where error log files will be saved.  You can put any directory you want, but a relativly logical naming convention is to put the (sub)domain before the title of the log, as done in this example.


Repeat the <VirtualHost *> directive for each (sub)domain you wish to set up.
Repeat the <VirtualHost *> directive for each (sub)domain you wish to set up.
12

edits