On 22 Dec 2011, at 18:29, Mark Eggers <its_toas...@yahoo.com> wrote:

> ----- Original Message -----
>
>> From: r.sriram <sri...@rstech.net>
>> To: Tomcat Users List <users@tomcat.apache.org>
>> Cc:
>> Sent: Wednesday, December 21, 2011 5:27 PM
>> Subject: Re: Hosted environment

<snip>

> Hmm, it certainly does work. I currently have about 100 virtual hosts, 8 
> CATALINA_BASE implementations, and SSL with a SAN Cert. I just finished 
> setting up another instance (took about 15 minutes) to do some application 
> testing.

The problem is that the OP is using Plesk, which has it's own ideas
about config file layout.

In my experience* the related config files are includes in a config
dir under the same part of the virtual host tree as the httpdocs dir.

Plesk regenerates some of these every time you update any of the
configured virtual hosts.

So we have to get the OP to edit files that won't be overwritten.


p

* not particularly recent, but sufficiently painful to be memorable.


> It's the setup I use because it cleanly decouples everything (Apache HTTPD 
> configurations, pristine CATALINA_HOME, default Tomcat applications for 
> connectivity / service testing, and an easy upgrade path). I'm toying around 
> with a script that will automate the entire installation, but I've not 
> reached that pain point yet.
>
> Briefly:
>
> In Apache HTTPD you need to do this:
>
> 1. Create a directory for each DocumentRoot - maybe C:\HTTPD\hosts\x.com
> 2. Create a named virtual host for each of the virtual hosts.
>    Something like the following:
>
>
> #
> # note that I've left out all of the mod_jk configuration
> # Please read the documentation
> #
>
> NameVirtualHost *:80
>
> #
> # Repeat for additional named virtual hosts
> #
> <VirtualHost *:80>
>     ServerAdmin your-em...@address.come
>     DocumentRoot C:/HTTPD/hosts/x.com
>     ServerName www.x.com
>     #
>     # Aliases as necessary
>     #
>     ServerAlias x.com
>     #
>     # Define your logging as you wish - this is just an example
>     #
>     ErrorLog logs/x.com-error_log
>     CustomLog logs/x.com-access_log common
> </VirtualHost>
>
> 3. In each named virtual host add a reference to a mount file.
>    There are lots of other ways to map stuff, this is one
>    Read the documentation
>
> Now the named virtual host looks like this:
> <VirtualHost *:80>
>     ServerAdmin your-em...@address.com
>     DocumentRoot C:/HTTPD/hosts/x.com
>     ServerName www.x.com
>     #
>     # Aliases as necessary
>     #
>     ServerAlias x.com
>     #
>     # Define your logging as you wish - this is just an example
>     #
>     ErrorLog logs/x.com-error_log
>     CustomLog logs/x.com-access_log common
>     #
>     # One of many ways to map resources to Tomcat - read the docs
>     # If your Apache HTTPD is in C:\Apache\Apache2.2\
>     # Or you can place it outside of the Apache directory tree - recommended
>     #
>     JkMountFile C:/Apache/Apache2.2/conf/extra/x.com.uriworkermap.properties
> </VirtualHost>
>
> 4. In x.com.uriworkermap.properties
>
> #
> # Map stuff
> # Add excludes if you place material where Apache HTTPD can directly serve 
> them
> # This will map everything
> #
> JkMount /=xcom
> JkMount /*=xcom
>
> 5. In workers.properties
>
> #
> # This is very minimal
> # Read the docs
> # port must match server.xml port for AJP connector
> #
> worker.list=xcom
>
> worker.xcom.type=ajp13
> worker.xcom.host=localhost
> worker.xcom.port=8009
>
> In Tomcat, do the following
>
> 1. Make a directory for your virtual host - maybe C:\AJP\x.com\webapps
>
> 2. Leave the default host alone
>
> 3. Make a name attribute of a Host element matches a named virtual host 
> ServerName
>
> <Host name="www.x.com"
>       appBase="C:/AJP/x.com/webapps"
>       autoDeploy="true"
>       unpackWARs="true">
>       <!-- add aliases if needed - match ServerAlias from httpd.conf -->
> </Host>
>
> 4. Make sure your AJP Connector is set up properly to match workers.properties
>
> <!-- something like the following - read the documentation -->
>     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
>                URIEncoding="UTF-8"/>
>
> All will work together happily.
>
> I've left out a lot. Here are things you need to read.
>
> 1. Apache HTTPD configuration for mod_jk (the AJP connector)
> 2. Apache HTTPD configuration for named virtual hosts
> 3. Tomcat connector configuration (lots of examples in the source code as 
> well)
> 4. Tomcat documentation - virtual hosts and AJP connector configuration
>
> If you want to serve static files with Apache HTTPD and the rest with Tomcat, 
> you'll need to do something like the following.
>
> If you're using Maven, build your project with mvn package, and then go to the
> <project-name>/target directory.
>
> You'll see both the WAR file and a directory <project-name> containing the 
> exploded web application. Just tar or zip the exploded web application and 
> include only those files you wish to include - I'm guessing *.css, *.html, 
> *.js, *.jpg, etc.
>
> Explode that tar or zip file in C:/HTTPD/hosts/x.com with the same directory 
> structure as your application. If it's the ROOT application, then explode the 
> tar or zip file in C:/HTTPD/hosts/x.com (for example).
>
> Now, use JkUnmount directives in x.com.uriworkermap.properties to not send 
> this off to Tomcat.
>
> If you use NetBeans, then the exploded web application is in 
> <project-name>/build/web.
>
> . . . . just my two cents.
> /mde/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to