简体   繁体   English

使用mod_cluster在Apache HTTPD中重写网址

[英]Url rewriting in Apache HTTPD with mod_cluster

I am new to Apache. 我是Apache的新手。 I have 2 jboss (Jboss as 7.1.1) and apache httpd server. 我有2个jboss(Jboss为7.1.1)和apache httpd服务器。 I am using mod_cluster for load balancing. 我正在使用mod_cluster进行负载平衡。 I wish to hide the jboss url from user and wish to show the user clean urls. 我希望向用户隐藏jboss网址,并希望向用户显示干净的网址。

for eg 例如

www.mydomain.com will be having my static website. www.mydomain.com将拥有我的静态网站。
subdomain.mydomain.com should go to mydomain.com:8080/myapp subdomain.mydomain.com应该转到mydomain.com:8080/myapp
subdomain.mydomain.com/mypage.xhtml should go to mydomain.com:8080/myapp/mypage.xhtml subdomain.mydomain.com/mypage.xhtml应该转到mydomain.com:8080/myapp/mypage.xhtml
sumdomain.mydomain.com/myservice should go to mydomain.com:8080/myapp/service.xhtml?name=myservice sumdomain.mydomain.com/myservice应该转到mydomain.com:8080/myapp/service.xhtml?name=myservice

I have tried many things with no success. 我尝试了很多事情,但都没有成功。 Can some one tell me if it is possible or not. 有人可以告诉我是否可行。 And if possible what are the things I should do. 如果可能的话,我应该做什么。

Thanks a lot in advance. 非常感谢。

Regards. 问候。

The reason you cannot do what you want is because you are trying to solve two very different problem at once. 您不能做自己想做的事情的原因是因为您试图同时解决两个非常不同的问题。 Separate them and solve them individually. 分开将它们单独解决。

Load balancer: I usually use Proxy for load balancer. 负载均衡器:我通常使用Proxy作为负载均衡器。 For example 例如

<Proxy balancer://mycluster>
BalancerMember http://wn1.seco.com
BalancerMember http://wn2.seco.com
</Proxy>
ProxyPass /test balancer://mycluster

Redirect and Forwarding: use mode_rewrite to redirect specific URLs to a different ones. 重定向和转发:使用mode_rewrite将特定的URL重定向到其他URL。

RewriteEngine  on
RewriteRule    "^/foo\.html$"  "/bar.html" [PT]

You can use mod_cluster and still stay in control of ProxyPass directives. 您可以使用mod_cluster,并且仍然可以控制ProxyPass指令。 Eg CreateBalancers 1 and then you could create the Proxies yourself ProxyPassMatch ^/static/ ! ProxyPass / balancer://qacluster stickysession=JSESSIONID|jsessionid nofailover=on ProxyPassReverse / balancer://qacluster ProxyPreserveHost on 例如, CreateBalancers 1 ,然后您可以自己创建代理ProxyPassMatch ^/static/ ! ProxyPass / balancer://qacluster stickysession=JSESSIONID|jsessionid nofailover=on ProxyPassReverse / balancer://qacluster ProxyPreserveHost on ProxyPassMatch ^/static/ ! ProxyPass / balancer://qacluster stickysession=JSESSIONID|jsessionid nofailover=on ProxyPassReverse / balancer://qacluster ProxyPreserveHost on . ProxyPassMatch ^/static/ ! ProxyPass / balancer://qacluster stickysession=JSESSIONID|jsessionid nofailover=on ProxyPassReverse / balancer://qacluster ProxyPreserveHost on See the relevant docs for mod_cluster 1.3.1.Final . 请参阅有关mod_cluster 1.3.1.Final的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM