记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。

How to change Tomcat manager default path ?


tomcat7默认访问管理web地址是 8080/manager,不怎么安全,需要修改下地址。

我这里就修改成 hbctmanager,需要新建个配置文件 hbctmanager.xml 放到/tomcat7/conf/Catalina/localhost/hbctmanager.xml


内容也很简单,将webapps下的manager目录文件移动到

/tomcat7/hbctmanager
再添加配置文件
<Context path="/hbctmanager"
        docBase="/tomcat/tomcat7/hbctmanager"
        antiResourceLocking="false" privileged="true" />
最后重新tomcat7,测试访问地址,可以正常访问,原来的目录删除掉。

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”.


分享到0

转载请标明出处【如何修改tomcat7中manager的默认web访问路径】。

《www.92cto.com》 虚拟化云计算,系统运维,安全技术服务.

名字:

个人主页地址:

E-mail:

评论列表