首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >tomcat 9主机管理器403访问被拒绝

tomcat 9主机管理器403访问被拒绝
EN

Stack Overflow用户
提问于 2017-07-16 17:12:47
回答 1查看 3.9K关注 0票数 2

我已经在centos 7.2服务器上设置了tomcat9。“服务器状态”和“管理器应用程序”按钮正在工作。但当您单击“主机管理器”按钮时,它会显示403访问被拒绝。

我的tomcat-users.xml中包含以下内容:

代码语言:javascript
运行
复制
<tomcat-users>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="my-admin" password="secret" roles="manager-gui,manager-status"/>
</tomcat-users>

这是我的管理器context.xml文件中的内容。在/usr/local/tomcat/webapps/manager/META-INF/context.xml中,我有:

代码语言:javascript
运行
复制
<?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.
-->
<Context antiResourceLocking="false" privileged="true" >
<!--
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
  <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
-->
</Context>

我注释掉了只能从本端IP (127.0.0.1)访问tomcat的IP限制。

我还尝试暂时禁用SELinux,看看这是否是问题所在。但我还是得到了同样的结果。

为什么这不起作用?我怎么才能纠正它呢?

EN

回答 1

Stack Overflow用户

发布于 2020-06-05 22:05:15

更改tomcat/webapps/manager/META-INF/context.xml文件,如下所示:

代码语言:javascript
运行
复制
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
     allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|66.66.66.666" />

其中66.66.66.666是您的远程IP地址。有关更多详细信息,请参阅文档- http://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Remote_Address_Valve

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45126914

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档