We are trying reverse-proxy between apache 2.2.22 and tomcat-7. The entires in my httpd.conf files are as below:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /apps/httpd-2.2.22/docroot/app1/
ServerName app1.mycompany.com
ErrorLog logs/app1.mycompany.com.error_log
CustomLog logs/app1.mycompany.com.access_log common
......
.........
</VirtualHost *.80>
<VirtualHost *:80>
DocumentRoot /apps/httpd-2.2.22/docroot/app2/
ServerName app2.mycompany.com
ErrorLog logs/app2.mycompany.com.error_log
CustomLog logs/app2.mycompany.com.access_log common
....
......
</VirtualHost *.80>
As am still waiting to get the SSL certs, just wanted to check HTTP requests for now. I am just giving the IP in browser to check everything works.
Requests from browser for both applications are landing on first virtual host.
http://1.2.3.4/app1 (Gives me the correct site)
http://1.2.3.4/app2 (Gives me wrong, as docroot it reads is of 1st host)
If i remove the app1 virtual host entry then http://1.2.3.4/app2 works fine.
We already have the same setup running in older server, so am not giving the url as http://app1.mycompany.com/app1 (by giving server name instead of IP). We need to replace it once we get this server setup up and running well.
When i give the old server's IP in browser, the applications turns up fine . Why its failing for this server? Do i need some extra setup for this?
How the ServerName maps up?
Forgot to mention that app1 and app2 are running on tomcat server which are at say machine A, and apache web server is on machine B. Do i need to do some configuration for this? Already the tomcat server details are there in worker.properties.