Skip to content

Hosts and Connectors

July 28, 2010
tags: ,

Host definition dynamic change

Use the host manager servlet to add/remove dynamically the virtual host definition
http://localhost:8080/host-manager/html/list
http://localhost:8080/manager/status

Difference – Host and Connector

Connectors have nothing to do with the configuration of your Host element(s).
You will have XX Connector elements, one for each IP address, each using the SSL
cert for one hostname. In Host you will XX alias – one for each naming of the IP address
If you have one connector only and no address defined then that port will be used for all IP address
of that machine – multiple IP with same port will use the same connector.
Need to give each a separate, non-overlapping appBase.

Host
A “physical” host is a hardware server, which may support many virtual hosts, either name-based (several at one IP address, Tomcat steers requests to corresponding web apps) or address-based (each app needs its own IP address). Since certificates are checked *before* Tomcat gets to attempt name-based virtual hosting, you need a dedicated IP address for each SSL-enabled app.
The hosts that tomcat uses have little to do with dns, and tomcat will not attempt to make any dns resolution. It will just match the to the port/network interface used for the contact, and inside that connector look for a that matches the browser send “host” HTTP 1/1 header. If you want several host names to serve the same thing, use the aliases inside host.

A domain may have many webapps deployed for it. Each domain also has to have one default webapp. When you have multiple, independent domains, each will need its own element with a unique appBase setting. Under each appBase, place the domain’s default webapp in the ROOT directory (or use a ROOT.war file).

Tomcat does not support wildcard multiple virtual Hosts, but you can set one webapp to be the default Host – it will then catch all requests that fail to match another Host.

Mod_proxy_ajp
ProxyPass /app ajp://hostname:ajpport/app
You can also use the [p] Proxy directive for mod_rewrite
RewriteRule ^/(.+).jsp(x?)(.+)* ajp://hostname:ajpport/$1.jsp$2$3

If AJP is in use , tomcat still starts with a warning message.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: