在apache服务器和tomcat之间设置代理的问题
我一直在尝试设置一个网络代理来重定向到位于
http://example.com 的 tomcat 应用程序:8085/应用程序。但我无法让它发挥作用。
<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 时,我想转到该应用程序。有人可以指出我做错了吗?
I have been trying to set up a web proxy to redirect to the tomcat app which is located at
http://example.com:8085/app . But I am not able to get it to work.
<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>
Following is the configuration from the server.xml file.
<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" />
Now this is what I am trying to do. When I type www.example.com or example.com I want to go to the app. Can someone give me pointers as to that I am doing wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要 mod_jk 或类似的东西来在 tomcat 和 apache 之间建立真正的连接。
尝试 这个
那里的代理设置更多的是为了隐藏端口号
You'll need mod_jk or something similar to do the real connection between tomcat and apache.
Try this
The proxy settings up there is more aimed for hiding the port number