Prev | Current Page 1204 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"


Individual sites are configured in the form of virtual hosts, which also are useful when only a single
site will be used. Here??™s how to configure a virtual host:
Create a file named /etc/apache/conf.d/vhosts.conf using this template:
NameVirtualHost *:80

ServerName www.example.org
ServerAlias web.example.org
DocumentRoot /home/username/public_html/
User username
Group groupname
DirectoryIndex index.php index.html index.htm

The NameVirtualHost line tells Apache to determine which virtual host to serve documents from
based on the hostname provided by the HTTP client. The *:80 specification means that requests
to port 80 on any IP address will be treated in this manner.
Similarly, the *:80 specification in the VirtualHost block indicates what address and port this
virtual host applies to. The port is optional for both the NameVirtualHost and VirtualHost
specifications but should always be used to prevent interference with SSL virtual hosts.
The ServerName and ServerAlias lines tell Apache which names this virtual host should be recognized
as, so replace them with names appropriate to your site. You can leave out the ServerAlias
line if you do not have any alternate names for the server, and you can specify more than one name
per ServerAlias line or have multiple ServerAlias lines if you have several alternate names.


Pages:
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216