美文网首页Linux服务器运维Linux运维路线
centos7 下httpd服务开启目录文件访问

centos7 下httpd服务开启目录文件访问

作者: 依然慢节奏 | 来源:发表于2019-07-17 21:29 被阅读0次
    • 查看/etc/httpd/conf.d/welcome.conf配置文件内容
    [root@localhost /var/www/html]#cat /etc/httpd/conf.d/welcome.conf 
    # 
    # This configuration file enables the default "Welcome" page if there
    # is no default index page present for the root URL.  To disable the
    # Welcome page, comment out all the lines below. 
    #
    # NOTE: if this file is removed, it will be restored on upgrades.
    #
    <LocationMatch "^/+$">
        Options -Indexes
        ErrorDocument 403 /.noindex.html
    </LocationMatch>
    
    <Directory /usr/share/httpd/noindex>
        AllowOverride None
        Require all granted
    </Directory>
    
    Alias /.noindex.html /usr/share/httpd/noindex/index.html
    Alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css
    Alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css
    Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif
    Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png
    
    • Options -Indexes中的-改成+号;
    <LocationMatch "^/+$">
        Options +Indexes
        ErrorDocument 403 /.noindex.html
    </LocationMatch>
    
    <Directory /usr/share/httpd/noindex>
        AllowOverride None
        Require all granted
    </Directory>
    
    Alias /.noindex.html /usr/share/httpd/noindex/index.html
    Alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css
    Alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css
    Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif
    Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png
    
    • 重启httpd服务:systemctl restart httpd
      image.png

    相关文章

      网友评论

        本文标题:centos7 下httpd服务开启目录文件访问

        本文链接:https://www.haomeiwen.com/subject/iqqhlctx.html