Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two apache servers running on windows 7. The one that comes bundled with XAMPP(running on port 80) and the one that comes with Zend(running on port 81). I would like to setup virtual hosts on the port 81. How would I go about this ? This is what I have put in the httpd-vhosts. In my

<VirtualHost *:81>
DocumentRoot "C:\Program Files (x86)\Zend\Apache2\htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:81>
DocumentRoot "C:/Program Files (x86)/Zend/Apache2/htdocs/youje"
ServerName youjenzi.localhost
</VirtualHost>

For the hosts file I have added the following line

127.0.0.1 youjenzi.localhost

The above entries above are redirecting me to XAMPP on port 80.

share|improve this question

migrated from serverfault.com Mar 28 '13 at 4:04

This question came from our site for professional system and network administrators.

1  
Your virtualhost config is not correct. You do not put the servername in the <Virtualhost> tag. All VirtualHost blocks for hosts on the same IP/port combination should start with the same tag. In this case <VirtualHost *:81> –  Krist van Besien Mar 27 '13 at 14:47
    
Thx Krist. Have made the changes to the vhost config and restarted Apache.It worked –  user1180807 Mar 27 '13 at 15:06
add comment

3 Answers

HTTP and HTTPS only work without port numbers on port 80 and port 443 respectively. If you have apache running on a non standard port, you will need to add the port to the address you type into your browser, ie; http://youjenzi.localhost:81.

DNS will not send you to a specific port, proxies and firewalls (and other things) can do so.

share|improve this answer
    
Thanks NickW. Am getting the message "The requested URL / was not found on this server." –  user1180807 Mar 27 '13 at 15:01
add comment

On the XAMPP server listening at tcp:80, place this:

ProxyRequests On
ProxyPreserveHost On
ProxyPass / http://localhost:81
ProxyPassReverse / http://localhost:81

Then you don't need to specify any ports in your address bar to explicitly end up reaching the Zend bundled apache.

That means you'll have a Reverse Proxy configuration on XAMPP (Not that you've had asked for, but 2 cents and another concept learnd)

share|improve this answer
add comment

I'm not sure how you'd configure apache, but you can add another IP address to your computer (or add an alias for your local host to your hosts file for the other application) and have both virtual servers run on the same port. I'm guessing it would look like:

<VirtualHost *:80>
DocumentRoot "C:/Program Files (x86)/Zend/Apache2/htdocs/youje"
ServerName youjenzi2.localhost
</VirtualHost>

and the host file would look like:

127.0.0.1 youjenzi.localhost
127.0.0.1 youjenzi2.localhost
share|improve this answer
    
Thx Snowburnt. Have resolved the issue. The problem was with my vhosts block. Have edited the code to reflect what correct code. How do I show that the problem is solved –  user1180807 Mar 27 '13 at 15:10
    
If they fixed it, add an answer yourself with what you did, then select it as the correct answer. –  NickW Mar 27 '13 at 15:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.