Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have three servers. Server A is a Apache Server, Server B and C are Tomcat Servers.

I added two new Virtual Hosts to the Apache

1st Host:

<VirtualHost *:80>
    ServerName dev.domain.com
    ErrorLog "/var/log/apache2/dev-server-error.log"
    CustomLog "/var/log/apache2/dev-server-access.log" combined
    SetEnvIf X-FORWARDED-PROTO https HTTPS=on

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    ProxyPass / http://servera.com:8080/
    ProxyPassReverse / http://servera.com:8080/

</VirtualHost>

2nd Host:

<VirtualHost *:80>
    ServerName test.domain.com
    ErrorLog "/var/log/apache2/test-server-error.log"
    CustomLog "/var/log/apache2/test-server-access.log" combined
    SetEnvIf X-FORWARDED-PROTO https HTTPS=on

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    ProxyPass / http://serverb.com:8080/
    ProxyPassReverse / http://serverb.com:8080/

</VirtualHost>

The first Host is working fine, but when I try to access the second host, I'm accessing the first one (I can see it by viewing the access log of the first host and accesing the second one)

What am I doing wrong???

share|improve this question
    
I doubt your virtual host configuration setting. IIRC, you need to have ip address in place of * in virtual host tag. Otherwise there will be only one running. Please confirm it with netstat command to see if two ip address are bound. –  Naai Sekar Mar 1 '13 at 12:53
    
    
But the server only has one IP... and I have a lot of other vhosts running directly on this server with the <VirtualHost *:80> Tag which are working.... –  Alexander Kiefer Mar 1 '13 at 13:21
    
verify that all DNS records in question point to the correct hosts. check on the servers and on the clients. don't forget to check /etc/hosts –  fuero Mar 1 '13 at 13:44
    
all DNS Records Show to Server A (Server A is the Apache) thats correct, because the apache should hide the other two servers (B and C) where the tomcats are running –  Alexander Kiefer Mar 1 '13 at 14:05

1 Answer 1

Don't use names in the ProxyPass fields, that can lead to NS issues. Instead use direct IP addresses.

Example, instead of:

ProxyPass / http://servera.com:8080/
ProxyPassReverse / http://servera.com:8080/

it should look like:

ProxyPass / http://1.2.3.4:8080/
ProxyPassReverse / http://1.2.3.4:8080/

Where of course 1.2.3.4 is the INTERNAL/LAN IP (NOT the external/WAN IP) of the machine the request is being forwarded to.

share|improve this answer
    
The suggestion is okay, but it is not an answer. Here you should only write answers to the original question. Later (over 50 reputation point) you could simply write this into comments, too. –  peterh Jan 22 at 10:06

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.