tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: LAMP + Tomcat Configuration
Date Sun, 11 Dec 2011 23:08:29 GMT
2011/12/11 Truckman <truckman@woodbridgedata.com>:
> Greetings,
>
>
>
> I apologize for the length/complexity of this but I've learned over the
> years providing more detail generally saves time of those who are kind
> enough to assist.
>
>
>
> I have a slew of "standard" webservers which run the usual LAMP model -
> CentOS6, Apache 2.2.15-5, MySQL 5.0.77-4, and PHP 5.3.2-6.  I host many
> virtual domains and each virtual server runs off a unique directory, roughly
> matching the assigned domain name, like so:
>
>
>
> http://forums.example.com translates to /var/www/html.forums
>
>
>
> No problems whatsoever, except now one of those virtual domains requires
> Tomcat6, and I'm trying to figure out how to integrate Tomcat6 for one
> virtual domain only.  This way, all the other domains I host can remain
> "as-is" in their working state.
>
>
>
> Using Yum, I installed Tomcat6 and the various auxiliary RPMs:
>

First, some bikesheds.

>
> apache-tomcat-apis-0.1-1.el6.noarch

I do not know what the above is.

> jakarta-commons-dbcp-tomcat5-1.2.1-13.8.el6.noarch
>
> jakarta-commons-pool-tomcat5-1.3-12.7.el6.x86_64

The above look like Tomcat 5.

>
> tomcat6-6.0.24-24.el6_0.noarch
>
> tomcat6-admin-webapps-6.0.24-24.el6_0.noarch
>
> tomcat6-docs-webapp-6.0.24-24.el6_0.noarch
>
> tomcat6-el-2.1-api-6.0.24-24.el6_0.noarch
>
> tomcat6-javadoc-6.0.24-24.el6_0.noarch
>
> tomcat6-jsp-2.1-api-6.0.24-24.el6_0.noarch
>
> tomcat6-lib-6.0.24-24.el6_0.noarch
>
> tomcat6-log4j-6.0.24-24.el6_0.noarch
>
> tomcat6-servlet-2.5-api-6.0.24-24.el6_0.noarch
>
> tomcat6-webapps-6.0.24-24.el6_0.noarch
>

A notable problem with most Linux distributions is that they provide
outdated versions of Apache Tomcat.

The current version of Tomcat 6 is 6.0.35.
The following page lists known security issues in Tomcat 6 releases:
http://tomcat.apache.org/security-6.html

The preferred way to install Tomcat is to download from
tomcat.apache.org and follow RUNNING.txt that is inside the archive.

Here is the file for Tomcat 7:
http://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt

The distribution does not contain init.d script - so look at the one
installed by CentOS for an example. Ultimately it has to sudo as
Tomcat installation owner, set environment properties and call
"catalina.sh start" and "catalina.sh stop" to start and stop the
server.. (Unless jsvc service wrapper is used'). I'd recommend to go
with separate CATALINA_HOME and CATALINA_BASE.  As a reminder: do not
run Tomcat as root.


>
>
> I started Tomcat6, added it to chkconfig so it automatically starts, and as
> I expected Tomcat6 answers on port 8009 (ajp) and port 8080 (tomcat).
>

Good.

>
> The customer then passed me a forums.war file, stating it needs to be in the
> root directory of the virtual server, so I placed it in the
> /var/www/html.forums directory.

??! You should not put Tomcat files into DocumentRoot. Tomcat has
special place for them. They should never be served by HTTPD directly.

>
>
>
> Knowing that apache is answering port 80, and that needs to be forwarded
> "up" to port 8080, I made the following changes in the virtual server
> configuration, like so:
>
>
>
> <VirtualHost  *:80>
>
>        Servername      forums.example.com
>
>        DocumentRoot    /var/www/html.forums
>
>        <Directory />
>
>          Options FollowSymLinks
>
>          AllowOverride All
>
>          Order allow,deny
>
>          Allow from all
>
>          ProxyPass ajp://localhost:8009/
>
>        </Directory>
>
> </VirtualHost>
>
>
>
> Now, when I hit http://forums.example.com, I get the expected Tomcat6
> welcome page,

Good.

> but http://forums.example.com/forums.war cannot be found.  I'm
> assuming that's because forums.war is located in the virtual directory in
> "regular apache" and not where "tomcat apache" is expecting it.

1. Read RUNNING.txt that I linked above
2. Find where $CATALINA_BASE/webapps directory is. That is where you
put the web applications.
The following applications are there by default:
  docs
  examples
  host-manager
  manager
  ROOT

3. If it is production server, remove examples. I'd also recommend to
remove docs and host-manager (never used).   The manager app is useful
if you learn to use it.

The ROOT is the default web application.

4. Rename forum.war -> ROOT.war.
5. Remove ROOT webapp and put new ROOT.war there.
6. Start Tomcat.
7. ROOT.war is effectively a zip archive. Tomcat will unpack it and it
will become the new "ROOT" webapp.

>
> I am really confused as what I should be doing next, or even if what I've
> done so far was "correct".
>
>
>
> The goal is to have "regular" apache answer port 80, and call upon "tomcat"
> on port 8080 (or 8009 ajp) as required by the web application stored in
> "regular" apache's virtual server directory for that domain.
>
>

Documentation: (for latest released version of Tomcat 6)
1) Guide:
  http://tomcat.apache.org/tomcat-6.0-doc/index.html
2) Configuration reference:
 http://tomcat.apache.org/tomcat-6.0-doc/config/index.html
3) FAQ:
 http://wiki.apache.org/tomcat/FAQ

Best regards,
Konstantin Kolinko

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


Mime
View raw message