I followed this excellent article about putting Apache in front of Tomcat, acting as a reverse proxy:
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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.xmlfiles.
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 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
Heya,
When you’re securing your Tomcat deployment with Apache or Nginx as a reverse proxy, you typically also want to secure access to the management GUIs provided by Tomcat, such as the Manager App and the Host Manager App.
context.xmlTomcat’s Manager and Host Manager apps are by default configured to be accessible only from the localhost. To allow access from remote machines, you have to modify the context.xml files for these apps. Here’s how to do it:
Open the Manager App’s context.xml
sudo nano /var/lib/tomcat8/webapps/manager/META-INF/context.xml
Comment out or Remove the IP Restriction
You’ll find a line similar to the following:
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
Comment out this line by wrapping it in tags, like so:
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
Repeat for the Host Manager’s context.xml
sudo nano /var/lib/tomcat8/webapps/host-manager/META-INF/context.xml
Then restart Tomcat
sudo systemctl restart tomcat8
Even after updating context.xml, you still can’t access the Tomcat Manager App if port 8080 is closed and only Apache is serving requests. You will need to create a reverse proxy rule for Apache to forward requests to the Manager App.
sudo nano /etc/apache2/sites-available/your-tomcat-site.conf
For the Manager App, add something like this:
<Location /manager>
ProxyPass ajp://localhost:8009/manager
ProxyPassReverse ajp://localhost:8009/manager
</Location>
sudo systemctl restart apache2
Now, try accessing the Tomcat Manager by going to:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.