天天看点

如何解决 Apache Tomcat 目录遍历漏洞

APACHE 的httpd.conf文件
      路径: vi ./conf/httpd.conf
  Options Indexes MultiViews  ← 找到这一行,将“Indexes”删除
    ↓
  Options MultiViews   ← 变为此状态(不在浏览器上显示树状目录结构)
AllowOverride None
Order allow,deny
Allow from all
</Directory>

TOMCAT修改conf/web.xml文件 
    <servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>false</param-value> // 这里改为false 重启就好了
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>