【发布时间】:2015-12-17 06:19:18
【问题描述】:
我有一个在 Tomcat 上运行的 java 门户,但我希望它的静态内容(html 除外)由 Apache httpd 提供服务。 所以我已经安装了一个 Apache httpd,现在我正在配置 httpd.conf 我知道我需要类似下面的文字:
<VirtualHost *:80>
DocumentRoot /opt/tomcat/webapps/ROOT
ServerName mywebapp.com
ServerAlias mywebapp.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPassMatch "^/(.*\.gif)$" "ajp://localhost:8009/$1"
ProxyPassReverse / ajp://localhost:8009/
但这是一个示例,我不知道如何在 ProxyPassMatch 前面使用 RegEx 来实现我的目的。
我的目的是通过 Apache httpd 提供 jpg、jpeg、gif、js、css 以及由 Tomcat 服务的其他
【问题讨论】:
-
你确定你应该在这样的引号中使用 ProxyPassMatch 的参数吗? ProxyPassMatch ^/(.*\.gif)$ ajp://localhost:8009/$1 如果这不起作用,请告诉我,我将运行一个本地示例并制定答案。 (或者其他人可能会在此之前发布一个)我认为应该这样做
-
在我的测试中,两个模型都可以工作(带引号和不带引号),但在 Apache 文档中它有引号。 httpd.apache.org/docs/2.4/mod/mod_proxy.html
-
好的,这是新的......我为 mod_proxy 打开的文档页面没有:) 足够公平。我看到您的问题是要获得超过 1 种类型的扩展匹配。我以为你在配置中有错误。我的道歉我可以很容易地帮助解决这个问题
-
没问题。谢谢@Joeblade
标签: java apache tomcat mod-proxy-ajp