Apache Tomcat - mani-ubuntu - home

thumbsshameServers

Nov 17, 2013 (3 years and 10 months ago)

206 views

10/12/2011
Apache TomcaW
1/5
hWWpV://help.XbXnWX.com/11.04/VeUYeUgXide/C/WomcaW.hWml
UEXQWX DRFXPHQWDWLRQ
>
UEXQWX 11.04
>
UEXQWX SHUYHU GXLGH
>
WHE SHUYHUV
>
ASDFKH TRPFDW
ASDFKH TRPFDW
ASDFKH TRPFDW LV D ZHE FRQWDLQHU WKDW DOORZV \RX WR VHUYH JDYD SHUYOHWV
DQG JSP (JDYD SHUYHU PDJHV) ZHE DSSOLFDWLRQV.
TKH TRPFDW 6.0 SDFNDJHV LQ UEXQWX VXSSRUW
WZR GLIIHUHQW ZD\V RI UXQQLQJ TRPFDW. YRX FDQ LQVWDOO WKHP DV D FODVVLF
XQLTXH
V\VWHP-ZLGH LQVWDQFH, WKDW ZLOO EH VWDUWHG DW ERRW WLPH ZLOO UXQ
DV WKH WRPFDW6 XQSULYLOHJHG XVHU. BXW \RX FDQ DOVR GHSOR\
SULYDWH
LQVWDQFHV WKDW ZLOO UXQ ZLWK \RXU RZQ XVHU ULJKWV, DQG WKDW \RX VKRXOG
VWDUW DQG VWRS E\ \RXUVHOI. TKLV VHFRQG ZD\ LV
SDUWLFXODUO\ XVHIXO LQ D
GHYHORSPHQW VHUYHU FRQWH[W ZKHUH PXOWLSOH XVHUV QHHG WR WHVW RQ WKHLU RZQ
SULYDWH TRPFDW LQVWDQFHV.
S\VWHP-ZLGH LQVWDOODWLRQ
TR LQVWDOO WKH TRPFDW VHUYHU,
\RX FDQ HQWHU WKH IROORZLQJ FRPPDQG LQ WKH WHUPLQDO SURPSW:
VXdo apW-geW inVWall WomcaW6
TKLV ZLOO LQVWDOO D TRPFDW VHUYHU ZLWK MXVW D GHIDXOW ROOT ZHEDSS
WKDW GLVSOD\V D PLQLPDO "IW ZRUNV" SDJH E\ GHIDXOW.
CRQILJXUDWLRQ
TRPFDW FRQILJXUDWLRQ ILOHV FDQ EH IRXQG LQ
/etc/tomcat6
. OQO\ D IHZ FRPPRQ FRQILJXUDWLRQ WZHDNV
ZLOO EH GHVFULEHG KHUH,
SOHDVH VHH
TRPFDW
6.0 GRFXPHQWDWLRQ
IRU PRUH.
CKDQJLQJ GHIDXOW SRUWV
B\ GHIDXOW TRPFDW 6.0 UXQV D HTTP FRQQHFWRU RQ SRUW 8080 DQG DQ
AJP FRQQHFWRU RQ SRUW 8009. YRX PLJKW ZDQW WR FKDQJH
WKRVH GHIDXOW
SRUWV WR DYRLG FRQIOLFW ZLWK DQRWKHU VHUYHU RQ WKH V\VWHP. TKLV LV
GRQH E\ FKDQJLQJ WKH IROORZLQJ OLQHV LQ
/etc/tomcat6/server.[ml
:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"

SeaUch

OIILFLDO DRFXPHQWDWLRQ
10/12/2011
Apache TomcaW
2/5
hWWpV://help.XbXnWX.com/11.04/VeUYeUgXide/C/WomcaW.hWml
UediUecWPoUW="8443" />
...
<ConnecWoU poUW="8009" pUoWocol="AJP/1.3" UediUecWPoUW="8443" />
Changing JVM used
B\ default Tomcat will run preferabl\ with OpenJDK-6, then tr\
Sun's JVM, then tr\ some other JVMs. If \ou have various JVMs
installed, \ou can set which should be used b\ setting JAVA_HOME in
/eWc/defaXlW/WomcaW6
:
JAVA_HOME=/XVU/lib/jYm/jaYa-6-VXn
Declaring users and roles
Usernames, passwords and roles (groups) can be defined centrall\
in a Servlet container. In Tomcat 6.0 this is done in the
/eWc/WomcaW6/WomcaW-XVeUV.[ml
file:
<Uole Uolename="admin"/>
<XVeU XVeUname="WomcaW" paVVZoUd="V3cUeW" UoleV="admin"/>
Using Tomcat standard webapps
Tomcat is shipped with webapps that \ou can install
for documentation, administration or demo purposes.
Tomcat documentation
The
WomcaW6-docV
package contains
Tomcat 6.0 documentation, packaged as a webapp that \ou can access b\
default at
http://\ourserver:8080/docs. You can install it b\ entering
the following command in the terminal prompt:
VXdo apW-geW inVWall WomcaW6-docV
Tomcat administration webapps
The
WomcaW6-admin
package contains
two webapps that can be used to administer the Tomcat server using a
web interface.
You can install them b\ entering the
following command in the terminal prompt:
VXdo apW-geW inVWall WomcaW6-admin
The first one is the
manageU
webapp, which
\ou can access b\ default at http://\ourserver:8080/manager/html. It is
primaril\
used to get server status and restart webapps.
10/12/2011
Apache TomcaW
3/5
hWWpV://help.XbXnWX.com/11.04/VeUYeUgXide/C/WomcaW.hWml
AcceVV WR Whe
manageU
aSSOicaWiRQ iV
SURWecWed b\ defaXOW: \RX Qeed WR defiQe a XVeU ZiWh Whe UROe
"PaQageU"
iQ
/etc/tomcat6/tomcat-users.[ml

befRUe \RX caQ acceVV iW.
The VecRQd RQe iV Whe
hoVW-manageU
ZebaSS,
Zhich \RX caQ acceVV b\ defaXOW aW
hWWS://\RXUVeUYeU:8080/hRVW-PaQageU/hWPO.
IW caQ be XVed WR cUeaWe YiUWXaO hRVWV d\QaPicaOO\.
AcceVV WR Whe
hoVW-manageU
aSSOicaWiRQ iV
aOVR SURWecWed b\ defaXOW: \RX
Qeed WR defiQe a XVeU ZiWh
Whe UROe "adPiQ" iQ
/etc/tomcat6/tomcat-users.[ml

befRUe \RX caQ acceVV iW.
FRU VecXUiW\ UeaVRQV, Whe WRPcaW6 XVeU caQQRW ZUiWe WR Whe
/etc/tomcat6
diUecWRU\ b\ defaXOW. SRPe feaWXUeV
iQ WheVe adPiQ
ZebaSSV (aSSOicaWiRQ deSOR\PeQW, YiUWXaO hRVW cUeaWiRQ)
Qeed ZUiWe acceVV WR WhaW diUecWRU\. If \RX ZaQW WR XVe WheVe
feaWXUeV
e[ecXWe Whe fROORZiQg, WR giYe XVeUV iQ Whe WRPcaW6 gURXS Whe QeceVVaU\
UighWV:
sudo chgrp -R tomcat6 /etc/tomcat6
sudo chmod -R g+Z /etc/tomcat6

TRPcaW e[aPSOeV ZebaSSV
The
tomcat6-e[amples
SacNage cRQWaiQV
WZR ZebaSSV WhaW caQ be XVed WR WeVW RU dePRQVWUaWe SeUYOeWV aQd JSP
feaWXUeV,
Zhich \RX caQ acceVV WheP b\ defaXOW aW
hWWS://\RXUVeUYeU:8080/e[aPSOeV. YRX caQ iQVWaOO WheP b\ eQWeUiQg Whe
fROORZiQg
cRPPaQd iQ Whe WeUPiQaO SURPSW:
sudo apt-get install tomcat6-e[amples
UViQg SUiYaWe iQVWaQceV
TRPcaW iV heaYiO\ XVed iQ deYeORSPeQW aQd WeVWiQg VceQaUiRV
ZheUe XViQg a ViQgOe V\VWeP-Zide iQVWaQce dReVQ'W PeeW Whe
UeTXiUePeQWV
Rf PXOWiSOe XVeUV RQ a ViQgOe V\VWeP. The TRPcaW 6.0 SacNageV iQ
UbXQWX cRPe ZiWh WRROV WR heOS deSOR\ \RXU
RZQ XVeU-RUieQWed iQVWaQceV,
aOORZiQg eYeU\ XVeU RQ a V\VWeP WR UXQ (ZiWhRXW URRW UighWV) VeSaUaWe
SUiYaWe iQVWaQceV ZhiOe VWiOO
XViQg Whe V\VWeP-iQVWaOOed
OibUaUieV.
IW iV SRVVibOe WR UXQ Whe V\VWeP-Zide iQVWaQce aQd Whe SUiYaWe
iQVWaQceV iQ SaUaOOeO, aV ORQg aV Whe\ dR
QRW XVe Whe VaPe TCP
SRUWV.
IQVWaOOiQg SUiYaWe iQVWaQce VXSSRUW
10/12/2011
Apache TomcaW
4/5
hWWpV://help.XbXnWX.com/11.04/VeUYeUgXide/C/WomcaW.hWml
YoX can inVWall eYeU\Whing neceVVaU\ Wo UXn pUiYaWe inVWanceV
b\ enWeUing Whe folloZing command in Whe WeUminal pUompW:
sudo apt-get install tomcat6-user
CUeaWing a pUiYaWe inVWance
YoX can cUeaWe a pUiYaWe inVWance diUecWoU\ b\ enWeUing Whe
folloZing command in Whe WeUminal pUompW:
tomcat6-instance-create m\-instance
ThiV Zill cUeaWe a neZ
m\-instance
diUecWoU\
ZiWh all Whe neceVVaU\ VXbdiUecWoUieV and VcUipWV.
YoX can foU e[ample inVWall \oXU
common libUaUieV in Whe
lib/
VXbdiUecWoU\ and deplo\ \oXU ZebappV in Whe
Zebapps/
VXbdiUecWoU\. No ZebappV aUe deplo\ed
b\ defaXlW.
ConfigXUing \oXU pUiYaWe inVWance
YoX Zill find Whe claVVic TomcaW configXUaWion fileV foU \oXU
pUiYaWe inVWance in Whe
conf/

VXbdiUecWoU\. YoX VhoXld foU
e[ample
ceUWainl\ ediW Whe
conf/serYer.[ml
file
Wo change Whe defaXlW poUWV XVed b\ \oXU pUiYaWe TomcaW inVWance Wo
aYoid conflicW ZiWh
oWheU inVWanceV WhaW mighW be UXnning.
SWaUWing/VWopping \oXU pUiYaWe inVWance
YoX can VWaUW \oXU pUiYaWe inVWance b\ enWeUing Whe folloZing
command in Whe WeUminal pUompW (VXppoVing
\oXU inVWance iV
locaWed
in Whe
m\-instance
diUecWoU\):
m\-instance/bin/startup.sh
YoX VhoXld check Whe
logs/
VXbdiUecWoU\ foU
an\ eUUoU. If \oX haYe a
java.net.BindE[ception: Address
alread\ in use<null>:8080
eUUoU, iW meanV WhaW Whe
poUW \oX'Ue XVing iV alUead\ Waken and WhaW \oX
VhoXld change iW.
YoX can VWop \oXU inVWance b\ enWeUing Whe folloZing
command in Whe WeUminal pUompW (VXppoVing
\oXU inVWance iV locaWed
in
Whe
m\-instance
diUecWoU\):
m\-instance/bin/shutdown.sh
RefeUenceV
See Whe
Apache TomcaW
ZebViWe foU moUe infoUmaWion.
10/12/2011
Apache TomcaW
5/5
hWWpV://help.XbXnWX.com/11.04/VeUYeUgXide/C/WomcaW.hWml
See the
Apache Tomcat
website for more information.
Tomcat: The Definitive Guide
is a good
resource for building web applications with Tomcat.
For additional books see the
Tomcat Books
list page.
Also, see the
Ubuntu Wiki Apache Tomcat
page.


Rub\ on Rails
Chapter 11. Databases
The material in this document is available under a free license, see
Legal
for details
For information on contributing see the
Ubuntu Documentation Team wiki page
. To report a problem, visit the
bug page for Ubuntu
Documentation