1、Apache与Jetty的联通
Apache:通过在httpd.conf文件中
- <IfModule mod_proxy.c>
- ProxyRequests Off
- ProxyPreserveHost On
- ProxyErrorOverride On
- <Directory proxy:*>
- Order deny,allow
- Allow from all
- </Directory>
- ProxyPass /r http://localhost:7001/r
- ProxyPass /a http://localhost:7001/
- SetEnv force-proxy-request-1.0 1
- SetEnv proxy-nokeepalive 1
- </IfModule>
解释:通过ProxyPass将/r转换为http://localhost:7001/r,将/a转换为ttp://localhost:7001/ ,即:将/r、/a访问的内容交给7001的jetty容器来处理。
在Jetty的配置文件(例如:simpleanti-jetty.xml)中,
- <Call name="addConnector">
- <Arg>
- <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
- <Set name="host"><Property name="jetty.host" default="localhost"></Property></Set>
- <Set name="port"><Property name="jetty.port" default="7001"/></Set>
- <Set name="maxIdleTime">20000</Set>
- <Set name="Acceptors">2</Set>
- <Set name="acceptQueueSize">256</Set>
- <Set name="statsOn">false</Set>
- <Set name="confidentialPort">8443</Set>
- <Set name="lowResourcesConnections">250</Set>
- <Set name="lowResourcesMaxIdleTime">5000</Set>
- </New>
- </Arg>
- </Call>
解释:通过<Set name="host"><Property name="jetty.host" default="localhost"></Property></Set> 将
接管apache传递过来的页面请求,再进行处理。
总结:Apache和Jetty之间通过mod_proxy.c进行通信的。
转载于:https://blog.51cto.com/tianya23/669073