【发布时间】:2012-01-06 02:06:21
【问题描述】:
我一直在尝试设置一个网络代理来重定向到位于的 tomcat 应用程序
http://example.com:8085/app 。但我无法让它工作。
<VirtualHost XXX.XXX.XXX.XX:80>
ServerName example.com
ServerAlias www.example.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /app http://localhost:8085/app
ProxyPassReverse /app http://localhost:8085/app
#ProxyPass / ajp://localhost:8085/ (tried this as well)
#ProxyPassReverse / ajp://localhost:8085/ (tried this as well)
<Location />
Order allow,deny
Allow from all
</Location>
#DocumentRoot /home/groupname/public_html (apache location - dummy)
DocumentRoot /usr/local/tomcat/apache-tomcat-6.0.33/webapps/app (tomcat location)
</VirtualHost>
以下是 server.xml 文件中的配置。
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Connector port="8085" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
现在这就是我想要做的。当我输入 www.example.com 或 example.com 时,我想访问该应用程序。有人可以指点我做错了吗。
【问题讨论】:
标签: apache tomcat proxy virtualhost reverse-proxy