本文介绍了Tomcat 8.5 - 403 访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Ubuntu 16.04 LTS 创建了一个虚拟机,并且遵循 本指南,我已经安装了 Tomcat 8.5 并配置如下:

I've created a virtual machine with Ubuntu 16.04 LTS and, following this guide, I've installed Tomcat 8.5 and configured as follows:

/opt/tomcat/webapps/host-manager/META-INF/context.xml:

<Context antiResourceLocking="false" privileged="true">
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="192\.168\.1\.124|127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>
<!-- my local ip is 192.168.1.124 so I've added it -->

/opt/tomcat/conf/tomcat-users.xml

<role rolename="manager-gui" />
<role rolename="admin-gui" />
<user username="myuser" password="MyPass123#" roles="manager-gui,admin-gui" />

没有修改其他配置文件.

No other configuration files has been modified.

当我尝试从浏览器访问管理器界面时出现问题,它不会询问我任何类型的凭据,而是向我抛出 403(拒绝访问)错误.

The problem comes out when I try to access to the manager interface from my browser, it doesn't ask me any kind of credentials and throws me a 403 (Access Denied) error.

我该如何解决这个问题?

How can I fix this problem?

推荐答案

这对我有用.请检查找到 CATALINA_HOME/webapps/manager/META-INF/context.xml 文件并在 Valve 周围添加注释标记.

This is worked for me. Please checkFind the CATALINA_HOME/webapps/manager/META-INF/context.xml file and add the comment markers around the Valve.

<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" />
-->
</Context>

Tomcat8 文档.

这篇关于Tomcat 8.5 - 403 访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 17:26