Hi at all!!!
Today I continue with the Case studies!! and now i’m going to speak about Apache Tomcat.
Apache Tomcat is a project by The Apache Software Foundation (ASF) so its licensend under Apache License v2.
Before to be an Apache Project i must say a little history about this.
Tomcat started as a servlet refference implementation by James Duncan Davidson, a software architect by Sun Microsystems.
Later he helped for Sun Microsystems gives the project as open source to the Apache Software Foundation.
Apache Tomcat is a servlet container, now developed by the Apache Software Foundation.
Apache Tomcat implements the Java Servlet and JavaServer Pages (JSP) specifications for Sun Microsystems, and provides a “pure java” http web server environment for java code to run.
Apache Tomcat includes tools for configuration and management but also it can be doing by xml configuration files.
Its important to differentiate Apache Tomcat from Apache Web Server, Apache Web Server is an open source Web Server developed also by the ASF but implements a complete web server developing in C language promgramming.
Well, and now i talk about how install, configure and use fast and easily your Apache Tomcat.
Once you have download the project, you have to decompress:
> tar xzvf apache-xx.tar.gz
When you have the project decompressed, you’ll can see several folders, first of all, we’re going to configure the users for admin and management tasks.
The file is under conf folder, so you can do this:
> cd apache-xx/conf/
and then with any text editor open it:
> gedit tomcat-users.xml
Here you can see some comments and examples user withoout functionality because there are commented for disable them.
Now you can write this:
<user username=”user_name” password=”passwd_user” roles=”admin, manager”/>
With this configuration the user mentioned have the two higher rights, admin and manager.
When you have finished to do this, you can save and exit.
Now, we see and configure (if we like) the Apache Tomcat configuration.
In the file server.xml we can see all configuration data of the server, including listen ports, secure http (https), threading pool, virtual hosts, etc.
The Apache Tomcat runs perfectly with this configuration, http would listen in the 8080 port and for https would listen in the 8443 port, but this functionality is disabled, if you want to use, just descomment this.
The threading pool is a configuration mode for get best performace because with this use the threads pool for reuse the threads and improve the functionallity, this must be done with carefully.
Virtual host section is for attend several virtual hosts, that is to say, if in your machine have two web portals and you can the Apache Tomcat have the recourses in differents locations and use them which such as different you just configure the virtual host section.
Then, when you’ve finished the configuration, you can save it and exit from this.
And before to run the Apache Tomcat, you have to be sure that you have the environment variables configured.
For Apache Tomcat we have to configure:
Using CATALINA_BASE: /home/user/apps/apache-tomcat-XX
Using CATALINA_HOME: /home/user/apps/apache-tomcat-XX
Using CATALINA_TMPDIR: /home/user/apps/apache-tomcat-XX/temp
Using JRE_HOME: /home/user/apps/jdk1.6.0_18/bin
Using CLASSPATH: /home/user/apps/apache-tomcat-XX/bin
If you haven’t this environment variables configured, you must to do.
And for finish, if you go to:
> cd apache-xx/bin/
you have scripts for run and stop the Apache Tomcat, but i preffer the use of the bootstrap.jar for it let to you more possibility to configure at starting:
> java -jar -Xms128M -Xmx512M bootstrap.jar
With this, we said that Apache Tomcat take 128MB for minimum memory and 512MB for maximum memory.
Then, Apache Tomcat would be start and listen in the port that you configure previously in the server.xml file.
Remember, by default Apache Tomcat listen in 8080 port (http).
For see that is all right, you can go with your webserver to http://localhost:8080 and you would see the Apache Tomcat welcome page.
And that’s all, see u!!!!