Abbey Workshop | ||||||||||
Often when working with the web, you need to work with more than one site at the same time. The combination of PHP and Apache can be configured to run a different web site on different server ports. The steps to do this are outlined below.
Below are the changes that need to be made to httpd.conf to setup two virtual hosts. One on port 80 and one on port 81.
# Lines that follow setup two virtual hosts on this machine # The following lines tell the Apache Server to listen on more than one port Listen 80 Listen 81 # The VirtualHost statements setup two document roots on different ports <VirtualHost 127.0.0.1:80> ServerAdmin temp@temp.com DocumentRoot "c:/dir1" ServerName www.host1.com </VirtualHost> <VirtualHost 127.0.0.1:81> ServerAdmin temp@temp.com DocumentRoot "c:/dir" ServerName www.host2.com </VirtualHost>
The Listen statements are needed to tell Apache to accept requests on those ports. The VirtualHost statement defines the location of the document root, links the host to one of the ports being listened to, and defines a host name for that port.
Copyright © Abbey Workshop 2006