阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Tomcat的Manager显示403 Access Denied

232次阅读
没有评论

共计 2854 个字符,预计需要花费 8 分钟才能阅读完成。

管理 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″/>
 
用户和密码都一目了然了。

2. 进入 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”/>
 
然后再加到需要的用户名中去
 
<user username=”tomcat” password=”tomcat” roles=”tomcat,manager-gui”/>
 
这样 OK 了。
 <?xml version=’1.0′ encoding=’utf-8′?>
 <!–
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the “License”); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
 

      http://www.apache.org/licenses/LICENSE-2.0
 

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an “AS IS” BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
 –>
 <tomcat-users>
 <!–
  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.
 –>
 <!–
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
 –>
 

 <!–
  <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″/>
 –>
    <role rolename=”manager-gui”/>
    <role rolename=”admin-gui”/>
    <user username=”ming” password=”064417″ roles=”manager-gui,admin-gui”/>
 

</tomcat-users>

在 Ubuntu 12.04 LTS 上通过 Tomcat 部署 Solr 4 http://www.linuxidc.com/Linux/2012-09/71158.htm

Ubuntu 下部署 Solr(4.4)到 Tomcat(7.0.53) http://www.linuxidc.com/Linux/2014-05/101443.htm

Linux 下 Apache 与多个 Tomcat 集群负载均衡 http://www.linuxidc.com/Linux/2012-01/51731.htm

Nginx Tomcat 集群负载均衡解决笔记 http://www.linuxidc.com/Linux/2013-07/86827.htm

实例详解 Tomcat 组件安装 +Nginx 反向代理 Tomcat+Apache 使用 mod_jk 和 mod_proxy 反向代理和负载均衡 http://www.linuxidc.com/Linux/2013-06/85290.htm

Apache+Tomcat 环境搭建(JK 部署过程)http://www.linuxidc.com/Linux/2012-11/74474.htm

Tomcat 的详细介绍 :请点这里
Tomcat 的下载地址 :请点这里

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计2854字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中