apache 配置

错误日志格式:
ErrorLog "|bin/rotatelogs.exe logs/error/error_%Y_%m_%d.log 86400 480"

请求日志格式:

CustomLog "|bin/rotatelogs.exe logs/netshop168/access_%Y%m%d.log 86400 480" combined

禁止ip访问

AcceptFilter http none
#AcceptFilter https none

<VirtualHost 121.42.52.55>
ServerName 121.42.52.55
#ErrorLog logs/121.42.52.55/error.log
#CustomLog logs/121.42.52.55-access.log combined
CustomLog "|bin/rotatelogs.exe logs/121.42.52.55/access_%Y%m%d.log 86400 480" combined
<Location />
Order Allow,Deny
Deny from all
</Location>
</VirtualHost>






#网页压缩

  编辑 http.conf 文件 需要开启

  去掉 #LoadModule headers_module modules/mod_headers.so 前面的注释#
  去掉 #LoadModule deflate_module modules/mod_deflate.so 前面的注释#
  去掉 #LoadModule filter_module modules/mod_filter.so 前面的注释# 


<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json #对指定的内容进行压缩,压缩方式为默认的一个方法 </IfModule> <IfModule mod_deflate.c> DeflateCompressionLevel 9 SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary #设置不对后缀gif,jpg,jpeg,png的图片文件进行压缩 SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary #同上,就是设置不对exe,tgz,gz。。。的文件进行压缩 SetEnvIfNoCase Request_URI .(?:pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary AddOutputFilterByType DEFLATE text/* #设置对文件是文本的内容进行压缩,例如text/html text/css text/plain等 AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript #这段代码你只需要了解application/javascript application/x-javascript这段就可以了,这段的意思是对javascript文件进行压缩 AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp #这段是告诉apache对php类型的文件进行压缩 BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.x 有一些问题,所以只压缩文件类型是text/html的 BrowserMatch ^Mozilla/4.0[678] no-gzip # Netscape 4.06-4.08 有更多的问题,所以不开启压缩 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # IE浏览器会伪装成 Netscape ,但是事实上它没有问题 </IfModule>

 

posted @ 2017-06-02 14:38  Abner3721  阅读(137)  评论(0编辑  收藏  举报