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.
Changing httpd.conf
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 portsServerAdmin temp@temp.com DocumentRoot "c:/dir1" ServerName www.host1.com ServerAdmin temp@temp.com DocumentRoot "c:/dir" ServerName www.host2.com # The Directory statements setup the permissions and behaviorsOptions Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all
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. The directory statements setup up the permissions and behaviors for the directory.