Location sets the expiration time of a file and does not log access logs

Source: Internet
Author: User

The root directory of the Web page would have been: 6 root/app/www/default;

1[[Email protected]default]# cat/app/server/nginx/conf/vhosts/default. conf2 server {3Listen the;4 server_name espressos.cn;5 index index.php index.htm index.html;6root/app/www/default;7Location ~. *\. (Sh|bash)?$ 8     {9         return 403;Ten     } One#if(!-e $request _filename) { A# rewrite ^/(. *) $/index.php last; - #        } -Location ~. *\. (PHP|PHP5)?$ the     { -#fastcgi_pass unix:/tmp/php-Cgi.sock; -Fastcgi_pass127.0.0.1:9000; - Fastcgi_index index.php; + include fastcgi.conf; -     } +Location ~. *\. (gif|jpg|jpeg|png|bmp|swf) $ A     { at expires 30d; -     } -Location ~. *\. (JS|CSS)?$ -     { - expires 1h; -     } ininclude/app/server/nginx/conf/rewrite/default. conf; -access_log/app/log/nginx/access/default. log; to}

Parameters: Access_log off-------> closed the log in to access logs for this page!!! The default is to log access logs.

[[Email protected]default]# tree/app/www/defaultapp/www/default/0Directories,0Files[[email protected]default]# tree/app/www/html//app/www/html/└──m.js0Directories,1File[[email protected]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+)/(. +)//$2? id=$1Last ; #location~ ^/(cron|templates)/{deny all; Break;} #location~ ^/data {deny all;} Location^~/html/m.js {access_log off;root/app/www;expires5; Break;} #expires 5 is valid for 5 seconds!! [[Email protected]default]# tail-f/app/log/nginx/access/default. log sx.log [[email protected]default]# Tail-1/app/log/nginx/access/default. Log192.168.1.10- - [ on/aug/ .: +: A: $+0800]"get/html/%5c%22/images/upload/image/1_07 (a). Jpg%5c%22 http/1.1" 404 168 "http://192.168.1.24/html/sql.html" "mozilla/5.0 (X11; Linux x86_64; rv:45.0) gecko/20100101 firefox/45.0"

Location sets the expiration time of a file and does not log access logs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.