How to change Tomcat manager default path ?

By default, Tomcat’s manager webapp is able to access via yourapp:8080/manager. It is a good practice to change the default /manager to something else, to avoid potential brute force attack.

Environment

  1. Tomcat 7 (apt-get install)
  2. Debian 7.5

1. Solution

This article show you how to change / rename the default manager webapp path from “/manager” to “/manager123”.


# Tomcat manager webapp
/usr/share/tomcat7-admin/manager

# Tomcat conf manager.xml
/var/lib/tomcat7/conf/Catalina/localhost/manager.xml

1.1 Rename Tomcat manager folder
Rename “manager” folder to a new folder name “manager123”, from /usr/share/tomcat7-admin/manager to /usr/share/tomcat7-admin/manager123


$ pwd
/usr/share/tomcat7-admin

$ sudo mv manager manager123

1.2 Update docBase in manager.xml
Update “docBase” in “manager.xml” and points it to the new renamed manager folder, “manager123”.

/var/lib/tomcat7/conf/Catalina/localhost/manager.xml

<Context path="/manager"
        docBase="/usr/share/tomcat7-admin/manager123"
        antiResourceLocking="false" privileged="true" />

1.3 Rename manager.xml
Rename “manager.xml” to “manager123.xml”, from /var/lib/tomcat7/conf/Catalina/localhost/manager.xml to /var/lib/tomcat7/conf/Catalina/localhost/manager123.xml


$ pwd
/var/lib/tomcat7/conf/Catalina/localhost

$ sudo mv manager.xml manager123.xml

1.4 Restart Tomcat
Done, restart Tomcat.


$ sudo service tomcat7 restart

Now, the Tomcat manager webapp path is changed to “/manager123”.

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Madrid Recent comment authors
newest oldest most voted
Madrid
Guest
Madrid

This save me some trial and error! Very useful, thanks!