码迷,mamicode.com
首页 > Web开发 > 详细

nginx关闭图片,js,css等的日志

时间:2014-08-08 18:24:56      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:nginx css js

一般来说这些日志的分析价值不高,而且还占用硬盘空间,一般都会关掉。

nginx配置:

     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$ {
                        access_log off;
                        proxy_pass              http://cdel_jxjy;

                        proxy_redirect          off;
                        proxy_set_header        Host $host;
                        proxy_set_header        X-Real-IP $remote_addr;
                        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                        client_max_body_size    10m;
                        client_body_buffer_size 512k;
                        proxy_connect_timeout   300;
                        proxy_send_timeout      300;

         
                        proxy_read_timeout      300;
                        proxy_buffer_size       64k;
                        proxy_buffers           32 64k;
                        proxy_busy_buffers_size 128k;
                        proxy_temp_file_write_size 64k;
                }

                location ~ .*\.(js|css)?$ {
                        access_log off;

                        proxy_pass              http://cdel_jxjy;
                        proxy_redirect          off;
                        proxy_set_header        Host $host;
                        proxy_set_header        X-Real-IP $remote_addr;
                        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                        client_max_body_size    10m;
                        client_body_buffer_size 512k;
                        proxy_connect_timeout   300;
                        proxy_send_timeout      300;
                        proxy_read_timeout      300;
                        proxy_buffer_size       64k;
                        proxy_buffers           32 64k;
                        proxy_busy_buffers_size 128k;
                        proxy_temp_file_write_size 64k;
                }

红色的地方是必须添加的,其他的可以按照自己的需求修改。同时这里也可以进行缓存的配置:expires      30d; 可以添加到里面就可以进行缓存了

本文出自 “屌丝程序员的逆袭” 博客,请务必保留此出处http://cdelliqi.blog.51cto.com/9028667/1537546

nginx关闭图片,js,css等的日志,布布扣,bubuko.com

nginx关闭图片,js,css等的日志

标签:nginx css js

原文地址:http://cdelliqi.blog.51cto.com/9028667/1537546

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!