如果连接器端口是8081,如何从apache tomcat中的URL中删除端口号
我在我的linux机器上运行了多个tomcat实例。 所以有不止一个连接器端口用于不同的实例,如8080,8081,8082。 我想从URL中删除端口号。
例如 :-
目前的url: – www.sushant.com:8081/
需要: – www.sushant.com/
请建议我怎么做这个。
谢谢。
您应该考虑在服务器上使用代理。 apache.org上有一个非常好的教程,使用Apache Web Server。
http://tomcat.apache.org/tomcat-7.0-doc/proxy-howto.html
这使您可以通过端口80连接到服务器,端口80不会打印在浏览器的URL栏中。
我看到上面的答案并且有点挣扎,所以想到自从我在ubuntu上以后的例子,所以我必须更改/etc/apache2/
的apache2.conf
文件你可以找到你的apache2.conf
文件或httpd.conf
根据您的操作系统
我添加了以下规则 –
ServerName sushant.com ServerAlias www.sushant.com ProxyRequests On Order deny,allow Allow from all ProxyPass http://localhost:7777/ ProxyPassReverse http://localhost:7777/ ServerName sushant.com ServerAlias www.sushant.com ProxyRequests on Order deny,allow Allow from all ProxyPass http://localhost:8081/ ProxyPassReverse http://localhost:8081/
所以,现在无论是否使用端口都能正常工作。