How to access Tomcat 8 admin gui from different host?

I followed this excellent article about putting Apache in front of Tomcat, acting as a reverse proxy:

https://www.digitalocean.com/community/tutorials/how-to-encrypt-tomcat-8-connections-with-apache-or-nginx-on-ubuntu-16-04

How can you access the admin gui from a remote machine, though? Since we closed port 8080 as part of the setup, I can't get to tomcat anymore. For example, going to:

/manager/html

gives me a 403 page:

"By default the Host Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Host Manager's context.xml file."

I do have a user set up in there as directed (from the setting up tomcat 8 tutorial), but this doesn't change anything. Restarted tomcat, still nothing.

How do you access the gui? Or is there a different way to deploy my web app war files?

Thanks

1 Answer

As covered in How To Install Apache Tomcat 8 on Ubuntu 16.04

By default, newer versions of Tomcat restrict access to the Manager and Host Manager apps to connections coming from the server itself. Since we are installing on a remote machine, you will probably want to remove or alter this restriction. To change the IP address restrictions on these, open the appropriate context.xml files.

If you followed that installation tutorial, those file can be found at:

  • /opt/tomcat/webapps/manager/META-INF/context.xml

  • sudo nano /opt/tomcat/webapps/host-manager/META-INF/context.xml

To allow remote access, edit the files and comment out the part of the configuration file specifying the IP address restriction or replace them with a list of IP addresses that you would like to whitelist.

context.xml files for Tomcat webapps
<Context antiResourceLocking="false" privileged="true" >
  <!--<Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />-->
</Context>

Restart Tomcat for the changes to take effect:


  
  
  • sudo systemctl restart tomcat

Remember, since Apache mod_jk makes a local connection to Tomcat on port 8080 and proxies it to port 443 over HTTPS (or port 80 if you are not setting up SSL), you will access it at https://your_ip_address/manager/html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值