内容目录
参考:http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
A default Tomcat installation includes the Manager. To add an instance of the Manager web application Context
to a new host install the manager.xml
context configuration file in the$CATALINA_BASE/conf/[enginename]/[hostname]
folder. Here is an example:
<Context privileged="true" antiResourceLocking="false" docBase="${catalina.home}/webapps/manager"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1" /> </Context>
在对应tomcat的 conf/Catalina/localhost/ 文件夹下 增加一个manager.xml ,里面写上
<Context privileged="true" antiResourceLocking="false" docBase="${catalina.home}/webapps/manager"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1" /> </Context>
就可以只容许通过 127.0.0.1 访问manager了。避免外网访问,部署恶意程序。
allow如果要容许其他内网ip或者localhost。可以参考如下:
<Context privileged="true" antiResourceLocking="false"
docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1|::1|0:0:0:0:0:0:0:1|localhost" />
</Context>
结果外网访问的时候就会提示403.而内网访问会弹出账号和密码输入界面。输入完成,进入到管理界面。管理。