Author | Message |
---|---|
jadiagaurang
Posts: 53
|
Posted 17:25 Feb 20, 2013 |
Hello Student of CS520, My question is not related to CS520 class. But, I thought this is one of the right place to ask my question. I have CentOS 6 with Tomcat7. I have configured tomcat on http://cloud.gaurangjadia.com:8080/ Now, I want to add few Virtual Host to my tomcat installation. I referred many forum topics. Such as,
But, no luck. If you know the correct XML markup for virtual host then let me know. Also, I have Varnish on 80, Apache on Port 81 and Tomcat on Port 8080. Can any one suggest me right way to forward my tomcat request from port 80 to 8080? Thanks in the anticipation. |
cysun
Posts: 2935
|
Posted 00:20 Feb 21, 2013 |
Well, first of all, why don't you read the actual Tomcat documentation on Virtual Hosting at http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html? Secondly, if you want to use Apache as a frontend to Tomcat, you probably should configure Virtual Host in Apache, not Tomcat. And finally, I use Proxy AJP to forward request from Apache to Tomcat, and it's very easy to set up. You need to enable proxy_ajp mod in Apache, enable AJP connector in Tomcat (usually it's enabled by default), and add something like these to your Apache VirtualHost directive: ProxyPass / ajp://localhost:8009/ |
jadiagaurang
Posts: 53
|
Posted 21:58 Feb 24, 2013 |
Thanks a lot Dr. Sun, I tired to follow Tomcat 7 Doc but it did not work. Doc says that use "appBase". But, it did not work for me. Not sure why! Finally, I updated my server.xml with <Context /> element under <Host /> element. I added "docBase" with value to the absolute path to directory of application. It is working for now.
<Host name="java.gaurangjadia.com">
<Context path="" docBase="/var/www/html/vhosts/gaurangjadia.com/java/public_html/"/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="java.gaurangjadia.com_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
</Host>
Thanks a lot for showing me way to forward request from Apache to Tomcat via ProxyPass!
|