【发布时间】:2016-06-14 16:21:17
【问题描述】:
所以,我有两台服务器,我们称它们为 nice#server 和 a#another#server
nice#server 是客户端将与之交谈的对象,它正在运行 Apache2,为简单的服务执行基本的反向代理,a#another#server 在 port 上托管一个专有的应用程序服务器。我需要在它们通过之前完全重写两个 url,但只需将一个文件夹添加到所有其他 URL。
下面的一些例子:
User Requests: nice#server/
Apache requests a#another#server:8080/appname
User Requests: nice#server/css#css
Apache requests a#another#server:8080/appname/css#css
User Requests: nice#server/a
Apache requests a#another#server:8080/appname/command1?name=option1
User Requests: nice#server/b
Apache requests a#another#server:8080/appname/app2?name=option2
我已经对此进行了很多谷歌搜索和测试,但似乎无法使其正常工作,抱歉我没有保留我尝试过的链接!!!我现在已经剥离了 vHost 文件。
<VirtualHost *:80>
ServerName service#domain#com
ErrorLog ${APACHE_LOG_DIR}/service-domain-com-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/service-domain-com-access.log combined
ProxyPreserveHost On
ProxyRequests off
ProxyPass / a#another#server:8080/
ProxyPassReverse / a#another#server:8080/
</VirtualHost>
提前感谢您提供有关如何执行此操作的任何指导。
【问题讨论】:
标签: apache mod-rewrite virtualhost mod-proxy