LAMP + Tomcat Configuration

2011-12-11 Thread Truckman
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:

 

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

jakarta-commons-dbcp-tomcat5-1.2.1-13.8.el6.noarch

jakarta-commons-pool-tomcat5-1.3-12.7.el6.x86_64

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

 

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).

 

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.

 

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, 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.

 

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.

 

 



Re: LAMP + Tomcat Configuration

2011-12-11 Thread Igor Cicimov
You need to deploy the war file inside tomcat so you need to make tomcat
aware of its location. Also including the war file in the uri makes no
sense it can not work like that. Did you do any configuration on the tomcat
side? Ajp connector etc. I would suggest you check the tomcat docs to gain
basic idea how tomcat works.
 On Dec 12, 2011 5:50 AM, Truckman truck...@woodbridgedata.com wrote:

 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:



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

 jakarta-commons-dbcp-tomcat5-1.2.1-13.8.el6.noarch

 jakarta-commons-pool-tomcat5-1.3-12.7.el6.x86_64

 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



 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).



 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.



 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, 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.



 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.








Re: LAMP + Tomcat Configuration

2011-12-11 Thread André Warnier

Truckman wrote:

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:

 


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

jakarta-commons-dbcp-tomcat5-1.2.1-13.8.el6.noarch

jakarta-commons-pool-tomcat5-1.3-12.7.el6.x86_64

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

 


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).

 


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.

 


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, 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.

 


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.


Hi.
Thank you for your nice and thorough explanation above, which makes a nice break from the 
I want to use Tomcat to connect to my CFDTY web service. Tell me asap and in detail how 
to do it kind of request.


Since you appear to be a real newbie with Tomcat (sorry if I'm wrong there), I have tried 
to write the following for someone who does not know Tomcat at all, but knows Apache httpd 
well.  I am thus trying to give you an overview, and some elementary pointers which may 
help you understand the excellent and extensive on-line documentation of Tomcat, available 
at http://tomcat.apache.org/tomcat-7.0-doc/
This will take just a few minutes to read, and will probably save you (and others on this 
list) a couple of hours of talking at cross-purposes.


Tomcat is a Java Servlet Engine first, and a webserver second.
As a java servlet engine, its *primary* function is to provide an environment suitable to 
run java servlets. Java servlets in turn are small (or less small) pieces of java code, 
which are usually grouped in a collection called a web application, or webapp.
So a webapp is a collection of such java servlets (programs) and of pure html pages 
(and/or of html pages containing a mixture of html and java code), the whole collection 
being designed generally to achieve something useful in a WWW context.


To make a parallel at this point with Apache httpd (with which you seem more 
familiar) :
Imagine that you have an Apache-httpd VirtualHost, with a DocumentRoot in 
/srv/www/myhost1/docs, and underneath that DocumentRoot you have a sub-directory 
/srv/www/myhost1/docs/accounting/ which contains the html pages and php scripts etc.. 
which together constitute .. an accounting application.

In Tomcat, this sub-directory and all the files in it would be called the 
accounting webapp.

One difference between Tomcat and Apache-httpd, is that under Tomcat you can install such 
an application in different ways :
- you can, as with Apache-httpd, just copy all the files that make up the webapp, in the 
sub-directory accounting of the Tomcat DocumentRoot (which under Tomcat is called the 
appBase)
- or you can zip all these files 

Re: LAMP + Tomcat Configuration

2011-12-11 Thread Konstantin Kolinko
2011/12/11 Truckman truck...@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