You can set up different websites on the same server. They are refered to by changing the server name ie Instead of referring to the website on the local machine as localhost you can refer to them as Instead of
http://localhost/
it would be
http://site1/
http://site2/
You must first add your host names to the hosts file in windowsTo do this edit C:\windows\system32\drivers\etc\hosts
Add an entry for each virtual server ie - The tcpip address for your local machine is
127.0.0.1 site1
127.0.0.1 site2
127.0.0.1 database
You will need to make these entrys in each computer you use to access your test server. If you need to access the server on a LAN I recommend setting up and using a domain name server.
Next Edit the httpd config file and at the bottom add
# Use name-based virtual hosting.
NameVirtualHost *
And for each site add
<virtualhost *>
ServerAdmin admin@site1
DocumentRoot “c:/program files/apache group/apache/site1”
ServerName site1
ErrorLog logs/site1.log
</virtualhost>
Where site1 is the name of the virtual server
DocumentRoot should point to a separate directory for each site it should be contained in quotes
If you have more than one server on your machine you should make these modifications to each httpd.conf configuration file.
After making the modifications restart the servers. Do start run and type cmd.
From the cmd prompt
net stop apache
net start apache
and if second server installed
net stop apache8080
net start apache8080
If a server fails to start then check the error log in the apache log directory ie
c:\program files\apache group\apache\logs
Tuesday, June 23, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment