tomcat 配置记要

tomcat 配置记录

以前我都是这样配置manager和admin的:

<?xml version="1.0" encoding="UTF-8"?>

<tomcat-users version="1.0" xmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd">

<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user password="123456" roles="manager-gui“ username="tomcat"/>
<user password="123456" roles="admin-gui" username="tomcat"/>

</tomcat-users>

今天下了tomcat8.0.17进行配置,竟然发现这样子不行了,要么manager可以admin不行,要么admin行manager不行,折腾了一会儿,看了官方文档,发现要这样配置了:

<?xml version="1.0" encoding="UTF-8"?>

<tomcat-users version="1.0" xmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd">

<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user password="123456" roles="manager-gui,admin-gui“ username="tomcat"/>

</tomcat-users>

这样配置,manager和admin才同时生效。