Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

configure virtual host on tomcat

I am able to run my application on tomcat with url as http://localhost:8080/pfaf/test.html.

In my application I am accessing the styles as /styles/abc.css. When opening the application I found in console that it is looking the css at http://localhost:8080/styles. where as when this application is running in WAS(it has a virtual host) it works great.

So can someone please help me in creating a virtual host on tomcat so that URL becomes as http://pfaf.localhost:8080/test.html

Thanks in advance,

-Ritesh

like image 863
Ritesh Avatar asked Jan 30 '26 01:01

Ritesh


1 Answers

In most versions of Tomcat, including Tomcat6 and Tomcat7, you add virtual hosts by adding a Host element to the Engine element in the server.xml file

http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html

Example:

   <Host name="pfaf.localhost" appBase="pfaf_webapps"   
        unpackWARs="true" autoDeploy="true"/>

To deploy a war file into this new virtual host, place it into $CATALINA_HOME/pfaf_webapps.

like image 197
robododge Avatar answered Jan 31 '26 19:01

robododge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!