zoukankan      html  css  js  c++  java
  • apache gzip

    1、首先启动模块mod_deflate.so和mod_headers.so

    2、httpd.conf

    #文件缓存时间配置
    <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css)$">
    Header set Cache-Control "max-age=2592000"
    </FilesMatch>
    #GZIP压缩模块配置
    <ifmodule mod_deflate>
    #启用对特定MIME类型内容的压缩
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|exe|t?gz|zip|bz2|sit|rar|pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary #设置不对压缩的文件
    AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-httpd-php application/x-javascript #设置对压缩的文件
    </ifmodule>

    httpd-vhosts.conf

    <VirtualHost *:80>
    DocumentRoot "D:/mb/mb03"
    ServerName mb3.bridecool.com
    <Location "/">
    SetOutputFilter DEFLATE
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch MSIE !no-gzip !gzip-only-text/html
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    Header append Vary User-Agent env=!dont-vary
    </Location>
    </VirtualHost>

    //禁止目录访问

    <VirtualHost *:80>
    #禁止目录访问
    <Directory "D:/website/2syx.com/Uploads">
    Options -Indexes FollowSymLinks
    #修改为 -Indexes 即可
    </Directory>
    。。。。。
    </VirtualHost>

  • 相关阅读:
    5-最长回文子串
    String、StringBuffer和StringBuilder的区别(转载)
    LeetCode31题,下一个排列
    BindingResult
    @Validated 和 @Valid
    springboot Filter Interceptor
    @ReponseStatus
    ResponseEntity
    springboot 异常处理机制源码分析
    @RequestMapping的produces作用
  • 原文地址:https://www.cnblogs.com/lovezhaolei/p/4362761.html
Copyright © 2011-2022 走看看