System environment:
[[email protected] etc] # uname-a # 1 SMP Fri Jan 17:17:51 EST. x86_64 x86_64 x86_64 gnu/linux [[email protected] etc] # Red Hat Enterprise Linux Server release 5.8 (Tikanga)
Software version:
Jetty-distribution-8.1.16.v20140903.tar.gz
Jdk-7u75-linux-x64-demos.gz
Httpd-2.2.29.tar.gz
In front of my experimental environment Apache and jetty have been installed, here is not introduced jetty installation, need to see my Jetty installation Blog
Before I had to do Apache and Tomcat integration, the default port for Tomcat and jetty was 8080, so here I need to change the port of jetty:
Modify jetty. jetty.xml file under the etc file:
## #将8080端口改为了8900<call name="AddConnector"> <Arg> <newclass="Org.eclipse.jetty.server.nio.SelectChannelConnector"> <set name="Host"><property name="Jetty.host"/></set> <set name="Port"><property name="Jetty.port"default="8900"/></set> <set name="MaxIdleTime">300000</Set> <set name="acceptors">2</Set> <set name="Statson">false</Set> <set name="Confidentialport">8443</Set> <set name="lowresourcesconnections">20000</Set> <set name="Lowresourcesmaxidletime">5000</Set> </New> </Arg> </Call>
To view Apache and jetty running status:
[[email protected] data]#Ps-ef|grep httpdRoot 3828 1 0 11:37? 00:00:00/VAR/DATA/APACHE/BIN/HTTPD-k Startapache3829 3828 0 11:37? 00:00:00/VAR/DATA/APACHE/BIN/HTTPD-k Startapache3830 3828 0 11:37? 00:00:00/VAR/DATA/APACHE/BIN/HTTPD-k Startapache3831 3828 0 11:37? 00:00:00/VAR/DATA/APACHE/BIN/HTTPD-k Startapache3832 3828 0 11:37? 00:00:00/VAR/DATA/APACHE/BIN/HTTPD-k Startapache3833 3828 0 11:37? 00:00:00/VAR/DATA/APACHE/BIN/HTTPD-k Startapache3834 3828 0 11:38? 00:00:00/VAR/DATA/APACHE/BIN/HTTPD-k Startroot4006 3517 0 13:47 pts/0 00:00:00grep httpd[[email protected] data]#ps-ef|grep JavaRoot 3944 1 0 11:41 pts/0 00:00:10/usr/local/jdk1.7/bin/java-djetty.state=/usr/local/jetty/jetty.state-dje Tty.home=/usr/local/jetty-djava.io.tmpdir=/tmp-jar/usr/local/jetty/start.jar Etc/jetty-logging.xml etc/jetty-Started.xmlroot4008 3517 0 13:47 pts/0 00:00:00 grep java
To view ports:
[[email protected] etc] # netstat-tpln|grep javatcp 0 0::: 8900 :::* LISTEN 3944/java [email (protected] etc]# netstat-tpln|grep httpdtcp 0 0::: + :::* LISTEN 3828/httpd
Jetty Startup method:
/usr/local/jetty/bin/jetty.sh Start-Start
/usr/local/jetty/bin/jetty.sh stop--close
Verify that jetty is started successfully, Access http://127.0.0.1:8900
Welcome to Jetty 8-remote access!!
If displayed, indicates that the JETYY has started successfully
Integrating Apache and jetty, static files are accessed through Apache, and are accessed dynamically through jetty.
Here I'm doing it through Http_proxy.
Modify the httpd.conf file, here Modify and Apache+tomcat Integration (ii), you need to load the proxy module:
# load Required Modules: LoadModule proxy_module modules/mod_proxy.soloadmodule proxy_connect_module modules/mod_proxy_ Connect.soloadmodule proxy_http_module Modules/mod_proxy_http.soloadmodule proxy_ajp_module modules/ mod_proxy_ajp.soloadmodule proxy_balancer_module Modules/mod_proxy_balancer.soloadmodule Rewrite_ Module Modules/mod_rewrite.so# when accessing the 1 folder, forward it to jetty processing:PROXYPASS/1 http://localhost : 8900/1/1 HTTP://LOCALHOST:8900/1
We need to create 1 directories under Jetty's WebApps folder, such as:
[Ro[email protected] etc] # LL.. /webapps/1/ Total 4-rw-r--r--1 root root 94 Apr 9 hello.jsp
Verify, Access HTTP://IP/1:
Summary: Overall apache+tomcat and Apache+jetty in fact the method is similar, the environment has been set up, the next is the optimization of the server, back to continue to refuel ~ ~ ~
Apache+jetty Integration