我想拥有一个Intranet网站,以至于
有一台具有静态IP地址的机器:192.168.88.80
通过主机文件映射到域: www.example.com
然后,我想映射一个地址,以便在浏览器地址栏中输入以下内容时: http://app.example.com
它在 http://www.example.com:8080/app 但是地址栏仍然显示 http://app.example.com
我尝试了几种组合,但无法配置。我不断得到 http://www.example.com:8080/app 。
有人有任何想法吗,最好使用apache httpd
谢谢
I want to have an intranet site such that
There is a machine with static IP address: 192.168.88.80
Mapped via hosts file to domain: www.example.com
Then I want to map an address such that when I enter the following in browser address bar: http://app.example.com
It loads my Tomcat hosted application at http://www.example.com:8080/app but address bar still displays http://app.example.com
I have tried several combinations but not able to configure such. I keep getting http://www.example.com:8080/app in my browser bar.
Does anyone have any idea, preferably using Apache httpd
Thanks
发布评论
评论(2)
您可以使用Apache HTTPD和Tomcat通过使用reverseproxy设置
取消点击Apache的httpd.conf文件中的适当行,以启用Apache mod_proxy和mod_proxy_http模块
loadModule proxy_module模块/mod_proxy.so
loadModule proxy_http_module模块/mod_proxy_http.so
proxypass/样本http:// localhost:8080/sample
proxypassReverse/示例http:// localhost:8080/sample
参见 https://www.theserverside.com/blog/coffee-talk-java-news-news-stories-and-andiores-and-opinions/how-to-configure-apache-apache-as-a-a-a-res-resverse-proxy-proxy-example 有关更多详细信息
You can achieve this using apache httpd and tomcat by using the reverseProxy settings
Uncomment the appropriate line in Apache’s httpd.conf file to enable the Apache mod_proxy and mod_proxy_http modules
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
add an Apache proxypass and an Apache proxypassreverse entry at the end of the httpd.conf file.
ProxyPass /sample http://localhost:8080/sample
ProxyPassReverse /sample http://localhost:8080/sample
See https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-configure-Apache-as-a-reverse-proxy-example for more details
解决此问题的最简单方法,没有任何额外的软件,是在端口80上运行tomcat ,该将修复8080的部分,并将您的战争文件命名为root.war,war,该文件解决上下文部分(
App
在URL中)。The simplest way to address this, without any extra software is, is to run Tomcat on port 80, which will fix the 8080 part, and to rename your war file to ROOT.war, which address the context part (the
app
in the URL).