网页的根目录本来是: 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 设定某个文件的过期时间,并不记录访问日志的更多相关文章

  1. LNMP-Nginx配置不记录静态文件、过期时间

    用户访问web网站,通常日志文件会记录很多web站点上的一些静态文件信息,如果长期不处理,日志文件会越来越大,占用的系统资源也越大,此时就需要我们配置不记录静态文件和过期时间,减少日志文件记录过多不必 ...

  2. Nginx图片及样式文件不记录访问日志

    1.Nginx作为web服务器是可直接在server配置文件中做如下配置: server { listen ; server_name www.fansik.com; access_log /data ...

  3. Oracle密码概要文件,密码过期时间180天修改为3天,相关用户密码是否过期

    #Oracle用户密码,概要文件修改测试 #默认的用户使用概要文件,默认概要文件密码过期时间参数180天,修改为3天,对于老的用户来说,是密码过期,还是未发生改变, 对于新用户来说,新设置的密码过期时 ...

  4. (转)网站速度优化技巧:Nginx设置js、css过期时间

    网站速度优化技巧:Nginx设置js.css过期时间 原文:http://www.webkaka.com/blog/archives/Nginx-set-the-expiration-time-for ...

  5. Redis学习笔记(十)——过期时间、访问限制与缓存

    http://irfen.me/redis-learn-10-time-expire-limit-cache/ 过期时间 之前应该提到过 redis 的特性之一是可以设置键的超时时间.命令是expir ...

  6. Nginx访问日志、 Nginx日志切割、静态文件不记录日志和过期时间

    1.Nginx访问日志 配制访问日志:默认定义格式: log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_loc ...

  7. Nginx访问日志、日志切割、静态文件不记录日志和过期时间

    6月8日任务 12.10 Nginx访问日志12.11 Nginx日志切割12.12 静态文件不记录日志和过期时间 12.10 Nginx访问日志 除了在主配置文件nginx.conf里定义日志格式外 ...

  8. Linux centosVMware Nginx访问日志、Nginx日志切割、静态文件不记录日志和过期时间

    一.Nginx访问日志 vim /usr/local/nginx/conf/nginx.conf //搜索log_format  日至格式 改为davery格式 $remote_addr  客户端IP ...

  9. nginx日志、nginx日志切割、静态文件不记录日志和过期时间

    2019独角兽企业重金招聘Python工程师标准>>> 12.10 Nginx访问日志 日志格式 vim /usr/local/nginx/conf/nginx.conf //搜索l ...

随机推荐

  1. Java中的break和continue关键字使用总结

    java中的break和continue关键字使用总结   一.作用和区别   break的作用是跳出当前循环块(for.while.do while)或程序块(switch).在循环块中的作用是跳出 ...

  2. OpenShift 容器日志和应用日志分离问题

    一般来说应用日志和容器日志一样输出到console,这样oc logs的时候就能把所有的获取到,但这种模式下输出的日志比较多,问题定位不方便,更多的时候开发人员只想通过应用日志来查看定位问题就够了,所 ...

  3. Python学习(六)模块 —— 第三方库

    Python 第三方库 安装第三方库 在Python中,安装第三方库包,是通过setuptools这个工具完成的.Python有两个封装了setuptools的包管理工具:easy_install和p ...

  4. 2 cocos2dx 3.0 源码分析-Director

    Director 导演类, 这个类在整个引擎中担当着最重要的角色, 先看看它是如何初始化的,它共管理了哪些内容呢?    1初始化- 更新处理Scheduler   Scheduler 这个类负责用户 ...

  5. Orchard运用 - 如何隐藏去除某些Meta标记

    众所周知,每个系统多多少少都会有一些痕迹或标记之类的东西, 比如默认的Orchard搭建的网站, 如果你查看源代码即可看到类似的代码: <meta content="Orchard&q ...

  6. go语言基础之不同作用域同名变量

    1.不同作用域同名变量 示例: package main import "fmt" var a byte //全局变量 func main() { var a int //局部变量 ...

  7. WinForm特效:同时让两个窗体有激活效果

    windows api,一个窗体激活的时候给另外一个发消息 using System; using System.Windows.Forms; using System.Runtime.Interop ...

  8. 【Python】Django filter 如何支持 or 条件过滤?

    from django.db.models import Q Item.objects.filter(Q(creator=owner) | Q(moderated=False)) 代码示例: if(r ...

  9. 【转】svn 的开发目录结构和流程

    原文: https://blog.csdn.net/iteye_15570/article/details/82548132 ------------------------------------- ...

  10. tarjan+缩点+强连通定理

    C - Network of Schools Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I ...