我有亚马逊应用程序运行的tomcat。 一切工作在Apache。 我不想每次都写端口号,所以我想build立一个简单的目录,在那里可以访问亚音速。
所以,我正在尝试在apache dir中创build虚拟主机文件。 (Ubuntu的服务器12.04)
我尝试了许多变化,但不能使任何工作:
<VirtualHost *:80> DocumentRoot /var/www/streamer ProxyPass / http://mini.local:4040/ ProxyPassReverse / http://mini.local:4040/ </VirtualHost>
你在做什么应该已经工作了。 我有类似的安装程序,其中运行8080的tomcat,我不想要外部URL(因此最终用户不应该知道我在8080上运行它)。
所以我做的是做类似于你所做的proxypass,也使用redirect匹配或redict永久性的情况下,我的内部URL的变化。 例如,如果我从http更改为https,而不想更改客户端API或其他应用程序的URL。
你应该尝试使用Apacheredirect模块。 这将允许您在内部redirect而不修改外部URL
例:
<VirtualHost *:80> ServerName test.web.site Redirect permanent / http://another.site.port </VirtualHost>
上面的例子将增加你已经在使用ProxyPass做的事情。
你可能想要考虑这样的事情。 自从我使用Tomcat以来,我已经有一段时间了,但是我为node.js应用程序做了一些非常类似的事情。 在我的场景中,文档根目录由节点来完成 – 这可能也是您的Tomcatconfiguration的情况,但是您可以testing,如果不是的话,只需根据需要添加DocumentRoot命令即可。
<VirtualHost *:80> ServerName mini.local ProxyRequests Off ProxyPreserveHost On <Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> ProxyPass / http://mini.local:4040/ ProxyPassReverse / http://mini.local:4040/ </VirtualHost>