0

I am running apache tomcat in a remote server, I have a domain with sub-domains. I want to assign each sub-domain with a separate project. I am unable to run apache on other domain except localhost. The domain is bind to the remote server IP Address so all sub-domains refers to all projects in webapps folder not one specific.

 <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host> <Host name="https://web-dev.example.com/" appBase="web-dev.example.com" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host> </Engine> 

1 Answer 1

1

The name attribute of your host should contain the DNS name of the virtual host:

Usually the network name of this virtual host, as registered in your Domain Name Service server. Regardless of the case used to specify the host name, Tomcat will convert it to lower case internally.

(cf. Tomcat documentation).

Therefore you should use:

 <Host name="web-dev.example.com" appBase="web-dev.example.com"> ... </Host> 

(I omitted the attributes with default values).

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Piotr for your response. I have tried this too earlier but it doesn't work, Irony is host name only allows me to use localhost only. If I remove it server didn't even start.
Can you clarify "it doesn't work"? Chances are, you are additionally using a reverse proxy (on port 80/443) to forward requests to Tomcat (on port 8080) and the reverse proxy is misconfigured. If this is the case can you add this information to your question?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.