By default manager application [hostname:8080/manager] or host-manager [hostname:8080/host-manager] just can be accessed by localhost on the same machine where tomcat server installed. So, if you try to access it from different machine/remote computer, you will get error notification like this “403 access denied you are not authorized to view this page”. The solution of this problem, you need to change some code from context.xml
Manager
1 |
#vi /opt/apache-tomcat-8.5.4/webapps/manager/META-INF/context.xml |
1 2 3 4 |
<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> |
Replace with this code
1 2 3 4 |
<Context antiResourceLocking="false" privileged="true" docBase="${catalina.home}/webapps/manager"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /> </Context> |
Host-Manager
1 |
#vi /opt/apache-tomcat-8.5.4/webapps/host-manager/META-INF/context.xml |
1 2 3 4 |
<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> |
Replace with this code
1 2 3 4 |
<Context antiResourceLocking="false" privileged="true" docBase="${catalina.home}/webapps/host-manager"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /> </Context> |
Next step, restart your tomcat server
1 2 |
#sh /opt/apache-tomcat-8.5.4/bin/shutdown.sh #sh /opt/apache-tomcat-8.5.4/bin/startup.sh |
Finally, access your tomcat manager from your remote host, e.g my tomcat server ip address is 192.168.1.1, so access it on your web browser with:
1 |
192.168.1.1:8080/manager or 192.168.1.1:8080/host-manager |