Page 1 of 1

Enable tomcat manager page?

Posted: Mon Feb 03, 2020 10:34 am
by admin
apache.png
1- Here are two files in which you have to make changes,

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

In the above both files change below as by default only these pages can open on localhost.

<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|192.168.*.*" />
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>

2 - Any lines between <!-- and --> will be treated as comments.

sudo nano /opt/tomcat/latest/conf/tomcat-users.xml
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
<user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
<user username="role1" password="<must-be-changed>" roles="role1"/>
-->
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui,admin-gui"/>

</tomcat-users>

3 - Stop and Start tomcat