1

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.

2
  • 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, 2013 at 14:47
  • Thx Krist. Have made the changes to the vhost config and restarted Apache.It worked
    – user1180807
    Mar 27, 2013 at 15:06

3 Answers 3

1

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.

1
  • Thanks NickW. Am getting the message "The requested URL / was not found on this server."
    – user1180807
    Mar 27, 2013 at 15:01
0

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)

0

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
2
  • 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, 2013 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, 2013 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .