進入tomcat,點擊管理模塊(Manager App)或者查看服務器狀態(Server Status),提示401 Unauthorized
提示如下頁面
原因是tomat默認沒有配置角色和用戶,按照提示頁面進行配置即可
打開tomcat安裝目錄,進入到conf\tomact_user.xml
<tomcat-users> <role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="tomcat" password="tomcat" roles="manager-gui"/> <user username="admin" password="123456" roles="manager-script"/> </tomcat-users>
重啟tomat服務,使用admin登錄即可
角色說明:
manager-gui
允許訪問html接口(即URL路徑為/manager/html/*)
manager-script
允許訪問純文本接口(即URL路徑為/manager/text/*)
manager-jmx
允許訪問JMX代理接口(即URL路徑為/manager/jmxproxy/*)
manager-status