`
jameswxx
  • 浏览: 772213 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

apache反向代理到jetty

阅读更多

apache和jetty组合使用有三种方式

There are three main ways to connect Apache to Jetty:
   1. Using Apache mod_proxy and a normal Jetty HTTP connector.
   2. Using Apache mod_proxy_ajp and the Jetty AJP connector.
   3. Using Apache mod_jk and the Jetty AJP connector. 

 

jetty推荐的是第一种

We recommend using the HTTP connectors for the following reasons:
    * Jetty performs significantly better with HTTP.
    * The AJP protocol is poorly documented and has many version irregularities.
If you must use AJP, the mod_proxy_ajp module is better than mod_jk. Previously, the load balancing capabilities of mod_jk meant that you had to use (tolerate) it, but with Apache 2.2, mod_proxy_balancer is available and works over HTTP and AJP connectors. 

 

第一种用mod_proxy,实际上是配置反向代理,只是简单的将url转发到jetty,如果要实现负载均衡,apache还需要加载mod_blancer。具体配置比较简单,首先在httpd.conf添加module

LoadModule proxy_module /usr/ali/apache2/modules/mod_proxy.so
LoadModule proxy_balancer_module /usr/ali/apache2/modules/mod_proxy_balancer.so
LoadModule proxy_http_module /usr/ali/apache2/modules/mod_proxy_http.so
LoadModule proxy_ajp_module /usr/ali/apache2/modules/mod_proxy_ajp.so
LoadModule jk_module /usr/ali/apache2/modules/mod_jk.so

 

然后在httpd.conf末尾加上反向代理配置

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /test http://localhost:8080/
ProxyPass / http://localhost:8080/

 

apache配置的是80端口,当访问http://localhost或者http://localhost/test时,请求应该转发到jetty,就是http://localhost:8080,配置完成后,启动apache,然后访问http://localhost,访问的是jetty页面。


如果要配置负载均衡,假设本机有两个jetty实例,监听端口分别是8080,8090。则简单的负载均衡配置部分如下

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /test balancer://mycluster
ProxyPass / balancer://mycluster

<Proxy balancer://mycluster>
BalancerMember http://localhost:8080
BalancerMember http://localhost:8090
</Proxy> 
 


分享到:
评论

相关推荐

    apache-jetty

    apache-jetty-

    apache+jetty负载配置案例

    ( apache+jetty负载配置案例.zip ) 亲测可用,文档+APACHE原文件,稍做修改即可直接使用,可隐藏后端真实服务器地址,加上域名则更完美!!! 有需要的朋友自行下载使用。

    jetty反相代理配置

    网上看到jetty-proxy有反相代理功能,根据很多网页配置并未成功,感觉是jetty版本更新比较快,文档跟不上,所以把我调试通过的上传一下。jetty版本9.4.6

    最新virgo-jetty-server

    用于Jetty的Virgo服务器、用于Jetty的Virgo服务器、用于Jetty的Virgo服务器

    nginx反向代理docker:Nginx反向代理Docker

    Nginx反向代理Docker容器 由nginx支持的反向代理的Docker映像。 概念 该git / docker图像旨在与反向代理示例以及其他两个Docker容器一起进行演示,以便人们可以轻松地学习如何使用此Docker容器创建反向代理: ...

    jetty相关的全部jar包

    jetty-security-9.4.8.v20171121.jar,jetty-io-9.4.8.v20171121.jar,jetty-continuation-9.4.8.v20171121.jar,jetty-client-9.4.8.v20171121.jar,jetty-jmx-9.4.8.v20171121.jar,jetty-plus-9.4.8.v20171121....

    Jetty cometd(Continuation)学习笔记

    Jetty允许Apache Licence 2.0或者Eclipse Public License 1.0双重许可。您可以再遵循上述任何一个许可的基础上将Jetty用于各种商业用途。 Jetty 7是Jetty奔向Eclipse后发布的第一个版本,本次的Jetty 7 RC2带给了...

    jetty内嵌到java代码启动

    jetty容器内嵌到java代码中,通过代码控制启动,方便开发调试

    Jetty中文手册

    从Jetty早期版本移植到Jetty 6 移植到Jetty 7 Porting to Jetty 8 Porting from Tomcat Jetty版本比较列表 参考 Jetty 7 Latest JavaDoc Jetty 7 Latest Source XRef Index of Generated Release Documents–API and...

    eclipse jetty插件run-jetty-run-1.3.3

    eclipse jetty插件,从...下载run-jetty-run.zip文件,解压后再编写个links文件丢到eclipse的dropins目录下即可,省去了使用eclipse update方式安装的麻烦。 link文件样例如: path=d:\\eclipse_plugins\\run-jetty-run

    Jetty多版本软件包

    Jetty软件包内容: jetty-distribution-9.4.51.v20230217.tar.gz jetty-distribution-9.4.51.v20230217.zip jetty-home-10.0.15.tar.gz jetty-home-10.0.15.zip jetty-home-11.0.15.tar.gz jetty-home-11.0.15.zip ...

    jetty6 指南书

    jetty是什么 jetty配置 jetty使用 jetty嵌入 jetty启动 jetty部署 jetty教程 jetty嵌入式 jetty

    jetty-distribution-9.4.47.v20220610

    jetty9.4.47用于部署或替换jar升级jetty解决安全漏洞 下载镜像地址https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.47.v20220610/

    PDF的JETTY文档

    .jetty

    jetty嵌入式服务器必须的jar包

    jetty嵌入式服务器开发所必须的jar包,本人使用jetty版本为6.1.3,jar包总数为9个,来自jetty:commons-el-1.0.jar,jasper-compiler-5.5.15,jasper-compiler-jdt-5.5.15.jar,jasper-runtime-5.5.15.jar,jetty-...

    Jetty嵌入项目代码中示例

    把${jetty_home}/etc目录下的jetty.xml、webdefault.xml文件复制到${project_home}/jetty/etc目录中。 把${jetty_home}/lib/jsp-2.1目录复制到${project_home}/jetty/lib目录下(如果不复制jsp-2.1或jsp-2.0也可以...

    jetty压缩包

    jetty,jetty Tar,项目中用到jetty,下载直接解压导入项目即可使用。

    jetty-9.4.6

    jetty-9.4.6

    jetty相关所有jar包

    jetty相关所有jar包,包含jar包: jetty-continuation-8.1.15.v20140411,jetty-http-8.1.15.v20140411,jetty-io-8.1.15.v20140411,jetty-security-8.1.15.v20140411,jetty-server-8.1.15.v20140411,jetty-util-8.1.15...

    jetty 学习资料合集

    jetty 学习资料合集 jetty 学习资料合集 jetty 学习资料合集 jetty 学习资料合集

Global site tag (gtag.js) - Google Analytics