请问各位懂nginx的,location ~ .*.(html)?$ {这个配置这样写正确吗,有什么改进和错误的语句吗
- location ~ .*.(html)?$ {
- proxy_ignore_headers X-Accel-Expires Cache-Control Expires Set-Cookie Vary;
- proxy_hide_header Cache-Control;
- proxy_hide_header Set-Cookie;
- proxy_hide_header Vary;
- proxy_set_header Accept-Encoding "";
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $host;
- proxy_set_header REMOTE_ADDR $remote_addr;
- proxy_redirect off;
- proxy_pass https://101.102.104.5;
- proxy_cache blo**n;
- proxy_cache_lock on;
- proxy_cache_lock_age 5s;
- proxy_cache_lock_timeout 5s;
- proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
- proxy_cache_background_update on;
- proxy_cache_min_uses 1;
- proxy_cache_valid 200 304 1d;
- proxy_cache_valid 500 502 503 504 0s;
- proxy_cache_valid any 10s;
- proxy_cache_revalidate on;
- proxy_cache_methods GET HEAD POST;
- add_header Cache-Control max-age=5;
- proxy_cache_key $uri$is_args$args;
- add_header CDN-Cache "$upstream_cache_status";
- #设置Cookie不缓存
- set $do_not_cache 0;
- if ($http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {
- #set $do_not_cache 1;
- }
- #跳过缓存
- proxy_cache_bypass $do_not_cache;
- #不保存缓存
- proxy_no_cache $do_not_cache;
- }
复制代码
⠀ |