So I currently have a glassfish 3.1 server and an apache 2.2 server running on a single box. However I am trying to figure out to route some traffic through the apache server to the glassfish server in order to hide the non-standard ports 8080,8181. I also have static content being served up on the apache server. I have done some searching and have read several examples that talk about doing this, however I am really new to apache and I am not understanding the virtualhost and mod_proxy stuff. Any help understanding these, and how to accomplish what I am trying to do would be great.
Per Shane example I tried the following.
<VirtualHost *:80> ServerName forum.mydomain.com # any logging config, etc, that you need ProxyPass / http://127.0.0.1:8080/forum/ ProxyPassReverse / http://127.0.0.1:8080/forum/ </VirtualHost>
But now all my traffic is going to http://127.0.0.1:8080/forum/ and for some reason all the images are missing. So let me better explain my scenario. I have an apache server that serves up static pages, those pages are access from mydomain.com. Than I have a forum which runs as a web app on my glassfish server and they are served on mydomain.com:8080/forum/ what I would like to do is have forum.mydomain.com go to the mydomain.com:8080/forum/ but hide the port 8080 from the user. Let me know what you think.
EDIT PART 2
So since my last attempt did not work I decided to try another deviation of Shane's examples so I tried the following.
<VirtualHost *:80> ServerName mydomain.com ServerAlias subdomain.mydomain.com DocumentRoot "/usr/local/apache/htdocs" <Location /forum> ProxyPass http://127.0.0.1:8080/forum/ ProxyPassReverse http://127.0.0.1:8080/forum/ </Location> </VirtualHost>
But this did not work either, now if I hit mydomain.com it takes me to mydomain.com//forums/list.page but it is a 404 Error (I think this is strange because it obviously got to the glassfish server because it re-routed to the list.page). However if I go to subdomain.mydomain.com it takes me to my normal static web pages. I feel like I have to be close but I am just not sure what is wrong. In this example I was hoping that mydomain.com and subdomain.mydomain.com would take me to my static pages, and mydomain.com/forum/ would take me to my forum app on glassfish.
EDIT Part 3 Final?
So I finally got the routing how I wanted it BUT for some reason the forum is missing all of its images. I ended up doing it with the following.
NameVirtualHost *:80 <VirtualHost *:80> ServerName www.mydomain.com ServerAlias subdomain.mydomain.com mydomain.com DocumentRoot "/usr/local/apache/htdocs" </VirtualHost> <VirtualHost *:80> ServerName forum.mydomain.com # any logging config, etc, that you need ProxyPass / http://127.0.0.1:8080/forum/ ProxyPassReverse / http://127.0.0.1:8080/forum/ </VirtualHost>
Now I just need to figure out the image problem . . .