Subdomain setup in tomcat7

I have both apache2 and tomcat7 installed on my server
apache running on port 80

and tomcat on port8080

My domain pedjaapps.net

points to my server ip and works fine (apache handles it as it should)

Now I want my subdomain api.pedjapps.net

on port "8080" to point to a subfolder api

on tomcat server

I tried changing the server.xml and added something like this:

<Host appbase="webapps/api" autodeploy="true" name="api.pedjaapps.net" unpackwars="true" xmlnamespaceaware="false" xmlvalidation="false">
    <Context docbase="/var/lib/tomcat7/webapps/api" path="" reloadable="true"></Context>
</Host>

      

but it still opens tomcat default page

api.pedjaapps.net also points to my servers ip in dns if it is relavent

+3


source to share


1 answer


If you don't want the default tomcat page, remove (or rename) webapps / ROOT and then change the name of webapps / api to ROOT. This will make your api app the default tomcat app. It's a quick (and dirty) solution if it suits your needs.



If that's not enough, you can set up virtual hosts in apache or tomcat. If done in tomcat, you need each virtual host point to be a separate webapps scope. See this for setup: http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html

+2


source







All Articles