网页的根目录本来是: 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. 使用NSHashTable存储引用对象

    NSHashTable 我们使用集合(NSArray,NSMutableArray,NSDictionary,NSMutableDictionary,NSSet,NSMutableSet)存储对象时会 ...

  2. 运行Hadoop的示例程序WordCount-Running Hadoop Example

      In the last post we've installed Hadoop 2.2.0 on Ubuntu. Now we'll see how to launch an example ma ...

  3. log4net 自定义Appender

    最近有个需求,使用log4net来记录日志,然后将数据保存到服务器端.一开始打算写一个windows service,定期上传日志. 后来又因为一些场景下不适应,因此直接改为保存内存中,到一定阀值之后 ...

  4. css整站规划

    准备1 css reset /** * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/) * http:/ ...

  5. java设计模式6--适配器模式(Adapter )

    本文地址:http://www.cnblogs.com/archimedes/p/java-adapter-pattern.html,转载请注明源地址. 适配器模式(别名:包装器) 将一个类的接口转换 ...

  6. [Python爬虫] 之三:Selenium 调用IEDriverServer 抓取数据

    接着上一遍,在用Selenium+phantomjs 抓取数据过程中发现,有时候抓取不到,所以又测试了用Selenium+浏览器驱动的方式:具体代码如下: #coding=utf-8import os ...

  7. An extensible Factory Pattern example

    I have read the book Api Design For C++ recently , and I must say that it is a masterpiece. There is ...

  8. Asp 将MSXML2.serverXMLHTTP返回的responseBody 内容转换成支持中文编码

    参考:ASP四个小技巧,抓取网页:GetBody,字节转字符BytesToBstr,正则表达式测试方法,生成静态页 Function GetBody(weburl) '创建对象 Dim ObjXMLH ...

  9. HDU 5025图论之BFS

    点击打开链接 题意:从K走到T,S为怪,走的时候就多花费一秒,走到T时收集m把不同的钥匙.可是规定收集n之前,必须1~n-1所有收集完成,怪最多有5个 思路:怪最多就有5个,然后钥匙是1~9把,我们每 ...

  10. Error: Cannot find module 'express' 之 解决方案

    出现如题错误,是因为执行了#npm install -g express的缘故,express没有被写到package.json里面去. 解决也好办,在程序目录下执行#npm install expr ...