location 设定某个文件的过期时间,并不记录访问日志
网页的根目录本来是: 6 root /app/www/default;
[root@web01 default]# cat /app/server/nginx/conf/vhosts/default.conf
server {
listen ;
server_name espressos.cn;
index index.php index.htm index.html;
root /app/www/default;
location ~ .*\.(sh|bash)?$
{
return ;
}
# if (!-e $request_filename) {
# rewrite ^/(.*)$ /index.php last;
# }
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
include /app/server/nginx/conf/rewrite/default.conf;
access_log /app/log/nginx/access/default.log;
}
参数:access_log off ------->关闭了记录这个页面的到访问日志里!!!默认是记录访问日志的。
[root@web01 default]# tree /app/www/default/
/app/www/default/ directories, files
[root@web01 default]# tree /app/www/html/
/app/www/html/
└── m.js directories, file
[root@web01 default]# cat /app/server/nginx/conf/rewrite/default.conf
#rewrite ^/index\.html /index.php last;
#if (!-e $request_filename) rewrite ^/(.*)$ index.php last;
#if (!-e $request_filename) {rewrite ^/(.*)$ /index.php last;}
#if (!-e $request_filename) {return 404;}
#if ($http_user_agent ~ Firefox) {rewrite ^(.*)?$ /nginx-Firefox/$1 break;}
#if ($http_user_agent ~ MSIE) {rewrite ^(.*)$ /nginx-MSIE/$1 break;}
#rewrite ^/(\d+)/(.+)/ /$?id=$ last;
#location ~ ^/(cron|templates)/ {deny all;break;}
#location ~ ^/data {deny all;}
location ^~ /html/m.js {access_log off;root /app/www;expires ;break;}#expires 5 有效期为5秒!!
[root@web01 default]# tail -f /app/log/nginx/access/
default.log sx.log
[root@web01 default]# tail - /app/log/nginx/access/default.log
192.168.1.10 - - [/Aug/::: +] "GET /html/%5C%22/images/upload/Image/1_07(61).jpg%5C%22 HTTP/1.1" "http://192.168.1.24/html/sql.html" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
location 设定某个文件的过期时间,并不记录访问日志的更多相关文章
- LNMP-Nginx配置不记录静态文件、过期时间
用户访问web网站,通常日志文件会记录很多web站点上的一些静态文件信息,如果长期不处理,日志文件会越来越大,占用的系统资源也越大,此时就需要我们配置不记录静态文件和过期时间,减少日志文件记录过多不必 ...
- Nginx图片及样式文件不记录访问日志
1.Nginx作为web服务器是可直接在server配置文件中做如下配置: server { listen ; server_name www.fansik.com; access_log /data ...
- Oracle密码概要文件,密码过期时间180天修改为3天,相关用户密码是否过期
#Oracle用户密码,概要文件修改测试 #默认的用户使用概要文件,默认概要文件密码过期时间参数180天,修改为3天,对于老的用户来说,是密码过期,还是未发生改变, 对于新用户来说,新设置的密码过期时 ...
- (转)网站速度优化技巧:Nginx设置js、css过期时间
网站速度优化技巧:Nginx设置js.css过期时间 原文:http://www.webkaka.com/blog/archives/Nginx-set-the-expiration-time-for ...
- Redis学习笔记(十)——过期时间、访问限制与缓存
http://irfen.me/redis-learn-10-time-expire-limit-cache/ 过期时间 之前应该提到过 redis 的特性之一是可以设置键的超时时间.命令是expir ...
- Nginx访问日志、 Nginx日志切割、静态文件不记录日志和过期时间
1.Nginx访问日志 配制访问日志:默认定义格式: log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_loc ...
- Nginx访问日志、日志切割、静态文件不记录日志和过期时间
6月8日任务 12.10 Nginx访问日志12.11 Nginx日志切割12.12 静态文件不记录日志和过期时间 12.10 Nginx访问日志 除了在主配置文件nginx.conf里定义日志格式外 ...
- Linux centosVMware Nginx访问日志、Nginx日志切割、静态文件不记录日志和过期时间
一.Nginx访问日志 vim /usr/local/nginx/conf/nginx.conf //搜索log_format 日至格式 改为davery格式 $remote_addr 客户端IP ...
- nginx日志、nginx日志切割、静态文件不记录日志和过期时间
2019独角兽企业重金招聘Python工程师标准>>> 12.10 Nginx访问日志 日志格式 vim /usr/local/nginx/conf/nginx.conf //搜索l ...
随机推荐
- go语言基础之闭包捕获外部变量特点
1.闭包捕获外部变量特点 示例: package main //必须 import "fmt" func main() { a := 10 str := "mike&qu ...
- Cognos权限认证CJP方式之用户密码加密
在项目开发过程中,用户往往对系统的安全都有明确的要求,下面针对cognos门户认证用户密码如何加密来提供一个简单的wf 1Cognos权限认证方式:CJP 2Cognos用户数据库类型:Oracle ...
- (转) [Flash/Flex] 用柏林噪音和滤镜制作翻腾的火焰效果----Flash AS3效应
下图展示的是通过柏林噪声和一些滤镜制作的火焰效果.这个效果是从舞台底部燃起的熊熊烈火.这个效果使用了BitmapData里的perlinNoise方法,以及ColorMatrixFilter和Disp ...
- 文件同步程序,Python和C写的DLL
#coding:utf-8 from ctypes import * from FileCopy import * def GetFilePathList(FilePath): dll = CDLL( ...
- [置顶] 深入浅出Spring(四) Spring实例分析
上次的博文中 深入浅出Spring(二) IoC详解 和 深入浅出Spring(三) AOP详解中,我们分别介绍了一下Spring框架的两个核心一个是IoC,一个是AOP.接下来我们来做一个Sprin ...
- Mysql Field * doesn't have a default value解决方法
Mysql Field * doesn't have a default value解决方法 MySQL 5中,出现错误提示: Field 'id' doesn't have a default va ...
- linux下php添加cur/soapl扩展
注意:在不同的扩展路径下 ./configure --help 的帮助信息不尽相同 1.跟php一起安装 下载 http://curl.haxx.se/download/ curl 取较低的版本 wg ...
- javascript 新知识
document.compatMode 属性 BackCompat: Standards-compliant mode is not switched on. (Quirks Mode) 标准模式 ...
- OFBiz:处理nextRequestResponse
这里的nextRequestResponse是指RequestHandler中doRequest()函数在最后使用的一个变量,doRequest()会依据nextRequestResponse返回不同 ...
- 最全的iOS物理引擎demo
概述 最全的iOS物理引擎demo,实现重力.碰撞.推力.摆动.碰撞+重力.重力弹跳.仿摩拜单车贴纸效果.防iMessage滚动效果.防百度外卖首页重力感应等效果! 详细 代码下载:http://ww ...