En este artículo instalaremos y configuraremos un servidor Apache2+mod_jk+Tomcat en un Ubuntu Server.
1.- Instalamos Apache:
apt-get install apache2 apache2-doc php4
2.- Editamos /etc/apache2/apache2.conf y modificamos:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
por esto:
DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml
3.- Reiniciamos Apache:
/etc/init.d/apache2 restart
Para arrancar Tomcat necesitaremos tener instalado el JDK y definir la variable JAVA_HOME.
1.- Nos descargamos JDK 5.0 desde http://java.sun.com/j2se/1.5.0/download.jsp.
2.- Ejecutamos el instalador:
./jdk-1_5_0_06-linux-i586.bin
chmod +x jdk-1_5_0_06-linux-i586.bin
3.- Una vez finalizado el instalador se habrá creado una carpeta que contiene los ficheros de Java. Lo movemos a /opt:
mv jdk1.5.0_06 /opt
4.- Creamos un softlink para facilitar las cosas:
cd /opt
ln -s jdk1.5.0_06 java
5.- Ahora le daremos el valor a la variable JAVA_HOME:
vi /etc/profile
JAVA_HOME=/opt/java
PATH=$PATH:/opt/java/bin
export PATH JAVA_HOME
y cargamos los cambios:
source /etc/profiles
1.- Nos descargaremos la versión binaria de apache-tomcat desde la siguiente URL:
http://tomcat.apache.org/download-55.cgi
2.- Descomprimimos el paquete:
tar xvzf apache-tomcat-5.5.16.tar.gz
3.- Lo movemos a /opt:
mv apache-tomcat-5.5.16 /opt
4.- Creamos un softlink para facilitar un poco las cosas:
cd /opt
ln -s apache-tomcat-5.5.16 tomcat
5.- Arrancamos el Tomcat:
cd /opt/tomcat/bin
./startup.sh
Para ver si está todo funcionando vamos abrimos algún navegador y entramos en la siguiente URL:
Por defecto el puerto que utiliza Tomcat es el 8080, si queremos modificar este valor solo tendremos que editar el fichero /usr/lib/apache-tomcat/conf/server.xml y modificarlo.
Para poder conectar Tomcat y Apache tendremos que instalar el mod_jk connector.
Nota: la conexión podría realizarse con un simple ProxyPass aunque con el mod_jk tendremos un mejor rendimiento y nos quitará los problemas de sesiones.
apt-get install libapache2-mod-jk
/etc/init.d/apache2 force-reload
1.- Creamos el fichero workers.properties:
touch /etc/apache2/workers.properties
2.- Editamos el fichero workers.properties y añadimos el siguiente contenido:
workers.tomcat_home=/opt/tomcat
workers.java_home=/opt/java
ps=/
worker.list=worker1
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1
3.- Creamos el fichero de configuración del mod_jk:
vi mods-available/jk.conf
JkWorkersFile /etc/apache2/workers.properties
JkMount /jsp-examples/* worker1
4.- Arrancamos el Tomcat:
/opt/tomcat/startup.sh
y reiniciamos el Apache:
/etc/init.d/apache2 restart
Para probar Apache:
Para probar Tomcat
Para probar la conexión entre Apache y Tomcat:
Comentarios recientes
8 weeks 1 day ago
22 weeks 2 days ago
27 weeks 5 days ago
36 weeks 3 days ago
44 weeks 2 days ago
51 weeks 5 days ago
1 year 3 days ago
1 year 12 weeks ago
1 year 12 weeks ago
1 year 15 weeks ago