Tomcat经理在ubuntu Droplet上显示403

时间:2016-06-15 14:15:37

标签: ubuntu tomcat digital-ocean tomcat8

我已经购买了数字海洋的ubuntu Droplet,我在配置访问tomcat管理器时面临问题。我已逐步按照以下教程完成所有步骤 - https://cloud.digitalocean.com/support/suggestions?article=how-to-install-apache-tomcat-8-on-ubuntu-14-04&page=0&query=tomcat%20manager

实际上我可以访问server-ip:8080上的tomcat主页但是在manager / html上访问被拒绝的问题

这是我的tomcat-users.xml -

<?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 xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
 version="1.0">
<!--
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. It is
  strongly recommended that you do NOT use one of the users in the commented out
  section below since they are intended for use with the examples web
  application.
-->
<!--
  NOTE:  The sample user and role entries below are intended for use with the
  examples web application. They are wrapped in a comment and thus are ignored
  when reading this file. If you wish to configure these users for use with the
  examples web application, do not forget to remove the <!.. ..> that surrounds
  them. You will also need to set the passwords to something appropriate.
-->
<user username="admin" password="password" roles="manager-gui,admin-gui"/>

</tomcat-users>

我已经尝试过我的用户和角色组合,但每次我都被拒绝访问。请帮忙

1 个答案:

答案 0 :(得分:1)

您需要为Manager App创建上下文并允许从Tomcat 8.5.x

进行访问

$CATALINA_BASE/conf/Catalina/localhost/主页下创建文件管理器

manager.xml内容,请注意我的源代码是172.31.254.37(我的电脑),将此更改为您的来源:

<Context privileged="true" antiResourceLocking="false"
         docBase="${catalina.home}/webapps/manager">
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="172\.31\.254\.37" />
</Context>

确保您的用户/角色已在$CATALINA_BASE/conf/tomcat-users.xml

中定义
<user username="tomcat" password="tomcat" roles="manager-gui,manager-status"/>

如果需要,你需要为主持人经理做同样的事情

亲切的问候,

Jacques de Jager