打开 omcat_8.5.34confserver.xml
文件
<!-- 限制指定IP地址访问Tomcat -->
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192.168.0.167||192.168.0.168" deny=""/>
限制整个站点不能访问,则要将
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192.168.1.*,192.168.2.*,*.mysite.com" deny=""/>
加入到
如果是要限制某个站点不能被访问,则要加入到
<Context path="/myweb" reloadable="true" docBase="E: omcat6webappsmyweb">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192.168.13.110,192.168.1.*,220.250.13.21" deny=""/>
</Context>
RemoteHostValve
根据主机名进行限制:
<Valve className="org.apache.catalina.valves.RemoteHostValve" allow="zhangsan" deny=""/>