zoukankan      html  css  js  c++  java
  • Apache显示目录列表及icons目录的问题

    今天想部署下开源项目pig,发现它的mysql需要5.7.8 +,为了能支持多个版本并且可以方便切换,所以选择了phpstudy_pro

    刚开始Apache不支持目录访问

    修改配置

    <VirtualHost _default_:80>
        DocumentRoot "D:/WWW"
        FcgidInitialEnv PHPRC "D:/phpstudy_pro/Extensions/php/php7.3.4nts"
        AddHandler fcgid-script .php
        FcgidWrapper "D:/phpstudy_pro/Extensions/php/php7.3.4nts/php-cgi.exe" .php
      <Directory "D:/WWW">
          Options Indexes FollowSymLinks ExecCGI
          AllowOverride All
          Order allow,deny
          Allow from all
         Require all granted
          DirectoryIndex index.php index.html
      </Directory>
    </VirtualHost>

    关键: Indexes显示目录

    添加后发现

    搜索了下Apache的配置目录conf,发现在conf/original/extra/httpd-autoindex.conf,将下面的都注释掉

    #Alias /icons/ "${SRVROOT}/icons/"
    
    #<Directory "${SRVROOT}/icons">
    #    Options Indexes MultiViews
    #    AllowOverride None
    #    Require all granted
    #</Directory>
    
    #
    # AddIcon* directives tell the server which icon to show for different
    # files or filename extensions.  These are only displayed for
    # FancyIndexed directories.
    #
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
    
    #AddIconByType (TXT,/icons/text.gif) text/*
    #AddIconByType (IMG,/icons/image2.gif) image/*
    #AddIconByType (SND,/icons/sound2.gif) audio/*
    #AddIconByType (VID,/icons/movie.gif) video/*
    
    #AddIcon /icons/binary.gif .bin .exe
    #AddIcon /icons/binhex.gif .hqx
    #AddIcon /icons/tar.gif .tar
    #AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
    #AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    #AddIcon /icons/a.gif .ps .ai .eps
    #AddIcon /icons/layout.gif .html .shtml .htm .pdf
    #AddIcon /icons/text.gif .txt
    #AddIcon /icons/c.gif .c
    #AddIcon /icons/p.gif .pl .py
    #AddIcon /icons/f.gif .for
    #AddIcon /icons/dvi.gif .dvi
    #AddIcon /icons/uuencoded.gif .uu
    #AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
    #AddIcon /icons/tex.gif .tex
    #AddIcon /icons/bomb.gif core
    
    #AddIcon /icons/back.gif ..
    #AddIcon /icons/hand.right.gif README
    #AddIcon /icons/folder.gif ^^DIRECTORY^^
    #AddIcon /icons/blank.gif ^^BLANKICON^^

     注:

      对于没有进行安全配置的Apache服务器,默认情况可以用xxx.com/icons/的方式打开Apache目录下的icons文件夹,并且会罗列出文件列表,这样很不安全。

      所以对上面代码进行注释,可以增加安全性。

      当然也应该禁止Apache显示目录索引(只需将 Option 中的 Indexes 去掉即可),这里是为了方便本地使用才打开的

    重启Apache

  • 相关阅读:
    Mac下终端常用命令
    mac上完整卸载删除.简单粗暴无脑:androidstudio删除方案
    Mac版 Intellij IDEA 激活
    解决Pods Unable to find a specification for `xxxxx`问题
    java并发编程(十五)内存可见两种方式 加锁和volatile
    java并发编程(五)正确使用volatile
    java并发编程(十四)同步问题的内存可见性
    java并发编程(十三)经典问题生产者消费者问题
    java并发编程(十三)线程间通信中notifyAll造成的早期通知问题
    java并发编程(十一)线程间的通信notify通知的遗漏
  • 原文地址:https://www.cnblogs.com/baby123/p/11326611.html
Copyright © 2011-2022 走看看