通过ip限制tomcat访问 [英] Restrict tomcat access by ip
问题描述
我想通过ip地址限制对tomcat服务器上运行的webapp的访问。
发现我必须使用 org.apache.catalina.valves.RemoteAddrValve
并将其设置为tomcat context.xml
I want to restrict access to a webapp running on a tomcat server by ip address.
Found out that I would have to use org.apache.catalina.valves.RemoteAddrValve
and set it in a tomcat context.xml
但在我的tomcat文件夹中我有4个:
But within my tomcat folder I have 4 of it:
\conf
\backup
\webapps\host-manager\META-INF
webapps\manager\META-INF
我必须在哪里放置规则?
Where to I have to place my Rule?
推荐答案
你必须选择 context.xml
,它位于 TOMCAT_HOME / conf /
下您希望将此限制应用于tomcat上运行的所有webapp。
You have to choose context.xml
which is under TOMCAT_HOME/conf/
if you want to apply this restriction to all webapps running on your tomcat.
选择 yourapp / META-INF / context.xml
如果你想保留它仅用于申请。
如果Web应用程序打包为WAR,那么 /META-INF/context.xml
将被复制到 $ TOMCAT_HOME / conf / [enginename] / [hostname] /
并重命名以匹配应用程序的上下文路径。
Choose yourapp/META-INF/context.xml
if you want to keep it only for application.
If the web application is packaged as a WAR then /META-INF/context.xml
will be copied to $TOMCAT_HOME/conf/[enginename]/[hostname]/
and renamed to match the application's context path.
webapps\manager\\ \\ METET-INF
=>如果您在此处添加限制,您的 tomcat管理器
将受到限制,即 tomcat管理
。
webapps\manager\META-INF
=> if you add restriction here, your tomcat manager
will be restricted i.e. tomcat administration
.
这篇关于通过ip限制tomcat访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!