使用Apache2作为Tomcat7的代理

时间:2015-05-21 15:33:12

标签: apache tomcat proxy

Tomcat7服务器在我的机器上托管一个网站,我想使用Apache2作为代理通过我的浏览器查看它:http://localhost:8080/exampleshttp://localhost/examples

我已经安装了Apache2和Tomcat7,它们都可以在我的电脑上运行。 我已经加载了mod_proxy和mod_proxy_http模块

在我的http_vhosts.conf文件中,我有:

<VirtualHost *:80>
  ProxyRequests off 
  SSLProxyEngine on
  ProxyPreserveHost on
  ServerName mathost.workstation.org
  ProxyPass /examples http://localhost:8080/examples
  ProxyPassReverse /examples http://localhost:8080/examples
  ProxyRequests Off
</VirtualHost>

在我的proxy_http.conf中,我有:

ProxyRequests Off
ProxyPreserveHost On
<Location "/examples/">
 ProxyPass /examples http://localhost:8080/examples
 ProxyPassReverse /examples http://localhost:8080/examples
 Order deny,allow
 Allow from all
</Location>

它不起作用,apache日志说“GET / examples / HTTP / 1.1”404 207“。

1 个答案:

答案 0 :(得分:1)

解决。 问题是路径“/ example /”。我必须使用正确的URL:“/ example”。 然后,http_vhosts.conf在端口80上有2个vhost,绝对没用。

相关问题