user1355300 user1355300 - 1 month ago 9
Apache Configuration Question

Adding virtual hosts for apache

I have IIS installed on my windows 7 which uses default port 80 and can be accessed at

http://localhost
. Now I have installed XAMPP as well and set the port 8081, so I can access it at
http://localhost:8081
.

Now, I want to add virtual host only for the xampp so that I can access it via
http://test/
instead of
http://localhost:8081
. I dont want to make any changes in IIS address and want to keep its address same. For that purpose, I have added virtual host in my xampp/apache/conf/extra/httpd-conf file ie.,

NameVirtualHost *:8081
<VirtualHost *:8081>
ServerAdmin admin@localhost.com
DocumentRoot "C:/xampp/htdocs"
ServerName test
ServerAlias test
</VirtualHost>


I have restarted the apache but still can not access the address
http://test
. Am I missing something or doing something wrong?

Answer

You have made XAMPP listen on Port 8081 rather thank 80 meaning that

http://test/

needs to be

http://test:8081/

Without a port number in a URL you are just referring to the default port (I.e. port 80 for http)

Update: This is actually possible, however IIS and Apache (XAMPP) need to use different IP addresses and only bind to port 80 on there own IP address. http://www.iislogs.com/steveschofield/iis7-post-44-iis7-and-apache-on-the-same-machine

If you can't touch IIS then the only alternative would be to use a proxy script to show a site on IIS which would proxy to 8081.

Comments