Friday 21 December 2012

Apache Virtual Hosting

*) http://httpd.apache.org/docs/trunk/vhosts/examples.html
  Your server has a single IP address, and multiple aliases (CNAMES) point to this machine in DNS. You want to run a web server for www.example.com and www.example.org on this machine.
 

Note:
  Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names. You must have the names in DNS, resolving to your IP address, or nobody else will be able to see your web site. You can put entries in your hosts file for local testing, but that will work only from the machine with those hosts entries.
Server configuration

# Ensure that Apache listens on port 80
  Listen 80

# Listen for virtual host requests on all IP addresses
  NameVirtualHost *:80

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

# Other directives here
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example.org

# Other directives here
</VirtualHost> 


No comments:

Post a Comment