我最近必须配置两个tomcat服务器。我使用版本8.5.13设置了一个tomcat服务器,并且工作正常。我可以毫无问题地访问服务器状态,管理器应用程序和主机管理器Web界面。
但是当我尝试通过从我构建的8.5.13服务器复制相同的配置来设置运行tomcat版本8.5.14的新tomcat服务器时,我在服务器状态和管理器应用程序上获得拒绝访问403。但奇怪的是只有Host Manager 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
两台服务器都具有相同的配置文件,从第一个工作服务器复制到第二个非工作服务器。
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>
两个tomcats的webapps 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)无效?
答案 0 :(得分:1)
您是否可以验证是否尝试从localhost以外的计算机访问此设备并且您没有在manager / META-INF / context.xml中注释掉RemoteAddrValve限制?您从主机管理器的context.xml中显示一个片段,并注释掉它并说您可以访问主机管理器,但并未真正确认您为管理器Web应用程序执行了相同的操作。