Tomcat web Server (Container)
Table of Contents
1 Tomcat
Tomcat erfordert ein JDK mit
$JAVA_HOME=/path/to/JDK
und
$PATH=$PATH:$JAVA_HOME/bin
(Open JDK, Ubuntu).
Details on how to configure the tomcat server can be found in the Ubuntu
pages Tomcat, Ubuntu, or at the apache site Tomcat6.
-
Installieren, system-wide installation (Tomcat Ubuntu):
sudo apt-get install tomcat6
-
Erreichbarkeit überprüfen (command-line or browser), where
<tomcat-host>
is localhost, the servername or the ip address.wget <tomcat-host>:8080 http://<tomcat-host>:8080
Durch apt-get werden angelegt (
ls -lh /var/lib/tomcat6
):-
$CATALINA_BASE = /var/lib/tomcat6
-
$CATALINA_HOME = /usr/share/tomcat6
-
Konfigurationsdateien (server-xml, tomcat-users.xml) in
/etc/tomcat
- Scripte in /etc/init.d/tomcat6
-
Deploying a Web-Application
- Server anhalten
sudo /etc/init.d/tomcat6 stop
- Web-Archiv (.war) in das webbapps Verzeichnis des servers kopieren:
cp myWebApp.war $CATALINA_BASE/webapps
- Server starten
sudo /etc/init.d/tomcat6 start
Erreichbarleit überprüfen: http://<tomcat-host>:8080/myWebApp
Tomcat is shipped with default Web-Applications (documentation, administration, examples), which you can install. Remember to remove before going productive/online.
sudo apt-get install tomcat6-docs sudo apt-get install tomcat6-admin sudo apt-get install tomcat6-examples
To use the application admin you have to define a user with role admin (Manager App HOW-TO).
Users and roles are defined in $CATALINA_BASE/conf/tomcat-users.xml
.
<tomcat-users> <role rolename="manager"/> <role rolename="admin"/> <user username="Markus" password="StrengGeheim" roles="admin,manager"/> <user username="Peter" password="StrengerGeheim" roles="manager"/> </tomcat-users>
Nach Neustart
sudo /etc/init.d/tomcat6 restart
kann eine Web-Applikation zur Adminstration vernwendet werden. So zeigt
http://localhost:8080/manager/list/
eine Liste der deploy-ten Applikationen.
Virtuelle Hosts werden in $CATALINA_BASE/server.xml
(im Engine-Abschnitt) definiert.
Im Beispiel unten werden für http://virtuellerHost.de
Applikation im Verzeichnis /opt/tomcat/webapps/virtuellerHost aufgerufen.
<Host name="virtuellerHost.de" appBase="/opt/tomcat/webapps/virtuellerHost"> <Context path="" docBase="." /> </Host>
Date: 2011-02-11 Fr
HTML generated by org-mode 7.4 in emacs 22