Configure Tomcat + Apache

Source: Internet
Author: User

1. tomcat configuration:/opt/apps/ACC/CAS /*

Bin/Start. Sh
Bin/Stop. Sh
Conf/Catalina. Policy
Conf/Catalina. Properties
Conf/logging. Properties
Conf/Server. xml
Conf/Web. xml
LIB/
Logs/
Temp/
Webapps/root/
Work/

Start. Sh

 
Export java_home =/usr/Java/LatestexportCatalina_home=/Usr/local/TomcatexportCatalina_base=/Opt/apps/ACC/Casexport catalina_pid=$ {Catalina_base }/Tomcat. PID $ {catalina_home}/Bin/Catalina. Sh start

Stop. Sh

 

Export java_home =/usr/Java/LatestexportCatalina_home=/Usr/local/TomcatexportCatalina_base=/Opt/apps/ACC/Casexport catalina_pid=$ {Catalina_base }/Tomcat. PID $ {catalina_home}/Bin/Catalina. Sh stop

 

Server. xml

<? XML version = '1. 0' encoding = 'utf-8'?> <Server port =" 9019 "Shutdown =" shutdown "> <listener classname =" org. apache. catalina. core. aprlifecyclelistener "sslengine =" on "/> <listener classname =" org. apache. catalina. core. jasperlistener "/> <listener classname =" org. apache. catalina. core. jrememoryleakpreventionlistener "/> <listener classname =" org. apache. catalina. mbeans. globalresourceslifecyclelistener "/> <listener classname =" org. apache. catalina. core. threadlocalleakpreventionlistener "/> <globalnamingresources> <Resource Name =" userdatabase "auth =" Container" Type = "Org. Apache. Catalina. userdatabase" Description = "User database that can be updated and saved" Factory = "Org. Apache. Catalina. Users. memoryuserdatabasefactory"Pathname = "CONF/tomcat-users.xml"/> </globalnamingresources> <service name = "Catalina"> <connector Port =" 9015 "Protocol =" HTTP/1.1 "Enablelookups =" false "/> <engine name =" Catalina "defaulthost =" localhost "> <realm classname =" org. apache. catalina. realm. lockoutrealm "> <realm classname =" org. apache. catalina. realm. userdatabaserealm" Resourcename = "Userdatabase"/> </realm>  Unpackwars = "True" autodeploy = "true"> <valve classname = "org. Apache. Catalina. Valves. accesslogvalve" directory = "logs"Prefix = "Localhost_access_log." suffix = ". txt" Pattern = "% H % L % u % t" % R "% S % B"/> 

2. Apache configuration:

/Usr/local/apache2/CONF/extra/httpd-vhosts.conf

 # Site: accountlisten  15013 <Virtualhost *: 15013 > Servername  11.22.33.44  DocumentRoot  /Opt/apps/ACC/CAS/webapps/root/ <Directory"/Opt/apps/ACC/CAS/webapps/root "> Options indexes followsymlinks AllowOverride none require all granted fileetag none </Directory> Proxypass /Cache. appcache! Proxypass /Favicon. ICO! Proxypass /CSS /! Proxypass /Images /! Proxypass /Img /! Proxypass /JS /! Proxypass /PIC /! Proxypass /Theme /! Proxypass /RES /! Addoutputfilter deflate CSS addoutputfilter deflate htm html shtml XHTML addoutputfilter deflate JS addoutputfilter deflate TXT text addoutputfilterbytype deflate text / HTML proxypass / HTTP : //  127.0.0.1:5015/ Proxypassreverse/ HTTP : //  127.0.0.1:5015/ Proxypreservehost on requestheader set X -Forwarded- PROTO HTTP </Virtualhost>

Because Tomcat uses HTTP, <connector Port = "9015" protocol = "HTTP/1.1" enablelookups = "false"/>

So the proxypass used by Apache is also HTTP, proxypass/HTTP: // 127.0.0.1: 5015/

If Tomcat uses AJP, <connector Port = "5015" protocol = "AJP/1.3" enablelookups = "false"/>

Then, Apache uses the proxypass AJP, proxypass/AJP: // 127.0.0.1: 5015/

Restart Apache:

/Usr/local/apache2/bin/apachectl restart

In addition, for HTTPS configuration, the statement is as follows:

Listen 6443 <Virtualhost *: 6443 > Servername t - Id.gionee.com DocumentRoot  /Opt/apps/ACC/CAS/webapps/root/ <Directory" /Opt/apps/ACC/CAS/webapps/root "> Options indexes followsymlinks AllowOverride none require all granted fileetag none </Directory> Proxypass /Cache. appcache! Proxypass /Favicon. ICO! Proxypass /CSS /! Proxypass /Images /!Proxypass /Img /! Proxypass /JS /! Proxypass /PIC /! Proxypass /Theme /! Addoutputfilter deflate CSS addoutputfilter deflate htm html shtml XHTML addoutputfilter deflate JS addoutputfilter deflate TXT text addoutputfilterbytype deflate text / HTML proxypass / AJP : //  127.0.0.1:5015/ Proxypassreverse/AJP : //  127.0.0.1:5015/  Proxypreservehost on requestheader set X -Forwarded- Proto https sslengine onSslcertificatefile "/Usr/local/Apache/CONF/t-id.xxx.com.crt" Sslcertificatekeyfile "/Usr/local/Apache/CONF/t-id.xxx.com.key" Sslcacertificatefile "/Usr/local/Apache/CONF/CA. CRT" </virtualhost>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.