Address Based Virtual Hosts

After you've configured your Linux machine with multiple IP addresses, setting up Apache to serve them as different websites is simple. You need only put a virtualHost directive in your httpd.conf file for each of the addresses you want to make an independent website:

<VirtualHost> ServerName

DocumentRoot /home/virtual/gnulix/public_html TransferLog /home/virtual/gnulix/logs/access_log ErrorLog /home/virtual/gnulix/logs/error_log </VirtualHost>

Use the IP address, rather than the hostname, in the virtualHost tag.

You can specify any configuration directives within the <virtuaiHost> tags. For example, you might want to set Aiiowoverrides directives differently for virtual hosts than you do for your main server. Any directives that aren't specified default to the settings for the main server.

Was this article helpful?

0 0

Post a comment