首页 文章

centOS htaccess文件上的Proxypass和ProxyPassReverse复制

提问于
浏览
0

我一直在尝试在Hostgator Centos服务器上托管的网站上复制ProxyPass和ProxyPassReverse . 我有一个运行在Amazon ec2上的tomcat应用程序,其URL为http://myec2address.com:8080/portal/

我成功地在本地Windows机器上复制了用例,并在httpd-proxy-html文件中进行了以下配置 .

ProxyPass / portalBI http:// :8080 / poratalBI

ProxyPass / sw-style http:// :8080 / sw-style

ProxyPass / portal-style http:// :8080 / portal-style

ProxyPassReverse / portalBI http:// :8080 / agrometricsBI

ProxyPassReverse / sw-style http:// :8080 / sw-style

ProxyPassReverse / portal-style http:// :8080 / portal-style

由于托管网站是共享服务器,我认为我将不得不修改我的.htaccess文件 . 我尝试了许多技巧但没有成功 . 你能帮忙吗?因为centOS,我们需要照顾特殊字符吗?

谢谢 .

1 回答

  • 1

    您不能在htaccess文件中使用 ProxyPassProxyPassReverse . 你可以做的最好的是使用mod_rewrite的 P 标志反向代理(相当于 ProxyPass ):

    RewriteEngine On
    RewriteRule ^portalBI(.*)$ http://localhost:8080/poratalBI$1 [L,P]
    RewriteRule ^sw-style(.*)$ http://localhost:8080/sw-style$1 [L,P]
    RewriteRule ^portal-style(.*)$ http://localhost:8080/portal-style$1 [L,P]
    

    赢得't work unless your shared host has mod_proxy loaded, and plus you don' t得到反向位置重写你将 ProxyPassReverse .

相关问题