2017-05-03 49 views
0

我不得不最近配置两个tomcat服务器。我已经使用8.5.13版设置了一个tomcat服务器,并且工作正常。我可以访问服务器状态,管理器应用程序和主机管理器Web界面,没有问题。tomcat管理界面给出403禁止的错误

但是,当我尝试通过从8.5.13服务器复制相同的配置来设置运行tomcat版本8.5.14的新tomcat服务器时,我建立了在服务器状态和管理器应用程序上获取访问被拒绝403。但奇怪的是,只有主机管理器Web界面能正常工作。我可以访问它。

我需要弄清楚为什么在第一台服务器上工作的配置相同,在第二台服务器上给我403拒绝。

这是我对每个:

工作服务器的Java:

java version "1.8.0_121" 
Java(TM) SE Runtime Environment (build 1.8.0_121-b13) 
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode) 

非工作的服务器有一个新的Java:

java version "1.8.0_131" 
Java(TM) SE Runtime Environment (build 1.8.0_131-b11) 
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) 

其他的都是相同的配置方面。

两者在/ etc/profile文件java和Tomcat的变量设置:

JAVA_HOME='/usr/lib/jvm' 
CATALINA_HOME='/usr/local/tomcat' 

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL JAVA_HOME CATALINA_HOME 

两个服务器都具有相同的配置文件,从第1个工作服务器复制到第二个非正常工作的服务器。

Tomcat用户配置:

cat /usr/local/tomcat/conf/tomcat-users.xml 
<tomcat-users> 
    <user username="admin" password="not_saying" roles="manager-gui,admin-gui"/> 
</tomcat-users> 

上下文配置文件有这样的:

cat /usr/local/tomcat/conf/context.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. 
--> 
<!-- The contents of this file will be loaded for each web application --> 
<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> 

而web应用的context.xml配置两个雄猫有这样的:

cat /usr/local/tomcat/webapps/host-manager/META-INF/context.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. 
--> 
<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> 

为什么是tomcat服务器1(版本8.5.13)工作和服务器2上较新的tomcat版本(8.5.14)不工作?

回答

1

你能确认你正在试图从除localhost和其他机器还没有注释掉的经理/ META-INF/context.xml中的RemoteAddrValve限制访问此?你从主机管理器的context.xml中显示一段代码,并将其注释掉,并说你可以访问主机管理器,但并没有真正确认你对管理器webapp做了同样的事情。