Actually, there's really nothing to virtual hosts...

>From my AS/400:
 
<VirtualHost 192.168.1.1:80> 
   DocumentRoot /WebProd/intranet/docs 
   UseCanonicalName off 
   HostNameLookups off 
   AddType application/vnd.ms-excel xls 
   AddType application/powerpoint ppt 
   AddType application/msword doc 
   ErrorLog /www/grimesvr/logs/error_log 
   TransferLog /www/grimesvr/logs/access.log 
   <Directory /WebProd/intranet/docs> 
      order allow,deny 
      allow from all 
   </Directory> 
</VirtualHost> 


<VirtualHost 192.168.1.1:8080> 
   DocumentRoot /WebQA/intranet/docs 
   UseCanonicalName off 
   HostNameLookups off 
   AddType application/vnd.ms-excel xls 
   AddType application/powerpoint ppt 
   AddType application/msword doc 
   ErrorLog Off 
   TransferLog None 
   <Directory /WebQA/intranet/docs> 
      order allow,deny 
      allow from all 
   </Directory> 
</VirtualHost> 

This is an IP based virtual host.  It'll handle all calls to the specified IP 
address on the specified port.  The
directives in the container are *mostly* optional.  If called on port 80, 
apache serves /WebProd/intranet/docs.  If port
8080, apache serves /WebQA/intranet/docs. 


>From my linux server:
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#  main server configuration
<VirtualHost *:80>
     DocumentRoot /www/fred.net
     ServerName www.fred.net
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /www/jungleroom.com
    ServerName www.jungleroom.com
</VirtualHost>

These are name-based virtual hosts.  same port but the apache server will serve 
/www/fred.net if the request is for
www.fred.net and /www/jungleroom.com for www.jungleroom.com


You can really go crazy with this stuff, but there's the basics....

dan

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.