在上一篇[Tomcat的下载与安装]中我们讲解了如何下载和安装Tomcat,当你解压好Tomcat时,点击进入后台时会出现以下的错误:
Tomcat5.x: HTTP Status 403 - Access to the requested resource has been denied
Tomcat6.x: 401 Unauthorized You will need to add manager role to the config file listed above. For example:
出现上面的情况是由于在tomcat-users.xml文件中没有配置好users的原因!
解决方法如下:
将tomcat-users.xml 文件内容改为(注:X:\Tomcat安装目录\conf)
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>
重新启动Tomcat ,在登录时使用 用户名admin 密码 admin 登录即可。