tomcat管理頁面登陸問題

管理tomcat的時候遇到了以下問題:

  1.剛開始需要用戶名密碼,不知道用戶名和密碼是什麼,但是輸入什麼都不正確。
  解決辦法:
  自己在tomcat-users.xml中按格式添加用戶 conf文件夾裏面
  默認是註釋掉了的,這主要是考慮到服務器的安全,如果是本地測試,去掉以下這段註釋,然後重啓動服務器,再輸入

   <role rolename="tomcat"/>
   <role rolename="role1"/>
   <user username="tomcat" password="tomcat" roles="tomcat"/>
   <user username="both" password="tomcat" roles="tomcat,role1"/>
   <user username="role1" password="tomcat" roles="role1"/>

用戶和密碼都一目瞭然了。

進入manager界面之後,顯示的是403 Access Denied。

  解決辦法:
  在conf/tomcat-users.xml文件中看到這麼一段話:
  NOTE: By default, no user is included in the “manager-gui” role required
   to operate the “/manager/html” web application. If you wish to use this app,
   you must define such a user - the username and password are arbitrary.
  也就是說,爲了考慮安全,tomcat默認還是沒有manager-gui的管理權限的,如果想要使用manager
  的話,需要自行加入管理權限(角色)。
  需要加一個這樣的權限(角色)

<role rolename="manager-gui"/>
<role rolename="admin-gui"/>

  然後再加到需要的用戶名中去
  

<user username="tomcat" password="tomcat" roles="tomcat,admin-gui,manager-gui"/> 

這樣OK了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章