{"id":14426,"date":"2017-06-23T11:52:01","date_gmt":"2017-06-23T02:52:01","guid":{"rendered":"https:\/\/sys-guard.com\/?p=14426"},"modified":"2017-06-25T04:36:27","modified_gmt":"2017-06-24T19:36:27","slug":"nginx-%e3%82%ad%e3%83%a3%e3%83%83%e3%82%b7%e3%83%a5%e3%81%95%e3%81%9b%e3%81%aa%e3%81%84-disable-cache-%e7%84%a1%e5%8a%b9%e5%8c%96","status":"publish","type":"post","link":"https:\/\/sys-guard.com\/post-14426\/","title":{"rendered":"Nginx \u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u305b\u306a\u3044 disable cache \u7121\u52b9\u5316"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13418img-responsive\" src=\"https:\/\/sys-guard.com\/contents\/wp-content\/uploads\/2017\/03\/apache_nginx_20170313_1.png\" alt=\"Apache Nginx\" width=\"680\" height=\"270\" \/><br \/>\n\u67d0\u30d5\u30ea\u30de\u30b5\u30fc\u30d3\u30b9\u306e\u30b7\u30b9\u30c6\u30e0\u5909\u66f4\u306e\u969b\u306b\u3001CDN\u306e\u4ed5\u69d8\u628a\u63e1\u3092\u8aa4\u3063\u305f\u70ba\u306b\u3001\u4f1a\u54e1\u60c5\u5831\u3092CDN\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u3066\u3057\u307e\u3044\u3001\u8cfc\u5165\u5c65\u6b74\u3001\u4f4f\u6240\u3084\u30af\u30ec\u30ab\u60c5\u5831\u306e\u4e00\u90e8\u3068\u3044\u3063\u305f<strong>\u4f1a\u54e1\u306e\u500b\u4eba\u60c5\u5831\u3092\u6f0f\u3048\u3044\u3057\u3066\u3057\u307e\u3063\u305f\u4e8b\u6545<\/strong>\u304c\u5148\u65e5\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3053\u3067\u4eca\u56de\u306fNginx\u306e\u57fa\u672c\u7684\u306a\u30ad\u30e3\u30c3\u30b7\u30e5\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306b\u95a2\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u304a\u3055\u3089\u3044\u3059\u308b\u8a18\u4e8b\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u307e\u305a\u306f\u30b7\u30f3\u30d7\u30eb\u306b\u3002<\/h2>\n<pre class=\"lang:default decode:true\"># vi \/etc\/nginx\/conf.d\/server.conf\r\n\r\nserver {\r\n     listen 80;\r\n     # \u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u306aIP\u30a2\u30c9\u30ec\u30b9\u3001\u3082\u3057\u304f\u306f\u30c9\u30e1\u30a4\u30f3\r\n     server_name 192.168.11.27;\r\n     root \/var\/www\/html;\r\n     index index.html;\r\n     proxy_set_header X-Real-IP $remote_addr;\r\n     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n     proxy_set_header Host $http_host;\r\n     proxy_redirect off;\r\n     proxy_max_temp_file_size 0;\r\n     location \/ {\r\n        expires -1;\r\n        proxy_pass http:\/\/localhost:8000;\r\n     }\r\n}\r\n\r\nserver {\r\n     listen 8000;\r\n     server_name localhost;\r\n     root \/var\/www\/html;\r\n     index index.html;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u5224\u5b9a<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14427img-responsive\" src=\"https:\/\/sys-guard.com\/contents\/wp-content\/uploads\/2017\/06\/nginx_no_cache_20170623_1.png\" alt=\"Nginx \u30ad\u30e3\u30c3\u30b7\u30e5 \u7121\u52b9\u5316\" width=\"660\" height=\"603\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>304\u306e\u5224\u5b9a\u3068Etag\u3082\u5224\u5b9a\u3055\u305b\u305f\u304f\u3042\u308a\u307e\u305b\u3093\u3002Etag\u306f\u30a2\u30f3\u30c6\u30ca\u30b5\u30a4\u30c8\u306a\u3069\u3068\u9023\u643a\u3057\u3066\u3044\u308b\u5834\u5408\u306b\u306f\u4e0d\u5177\u5408\u306b\u306a\u308b\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>sendfile<\/strong><br \/>\nOS\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u3002<\/li>\n<li><strong>if_modified_since<\/strong><br \/>\n\u66f4\u65b0\u901a\u77e5\u3092\u5224\u5b9a\u3057\u307e\u3059\u3002304\u306e\u5834\u5408\u306f\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u306b\u3044\u304d\u307e\u305b\u3093\u3002<\/li>\n<li><strong>Etag<\/strong><br \/>\n\u30d6\u30e9\u30a6\u30b6\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u7ba1\u7406\u756a\u53f7\u3088\u3046\u306a\u3082\u306e\u3001\u30b5\u30fc\u30d0\u5074\u3067\u66f4\u65b0\u3055\u308c\u305f\u3089\u5024\u304c\u5909\u308f\u308b\u306e\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u306f\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u306b\u3044\u304d\u307e\u3059\u3002\u540c\u3058\u5024\u3067\u3042\u308c\u3070\u66f4\u65b0\u3055\u308c\u3066\u3044\u306a\u3044\u3082\u306e\u3068\u3057\u3066\u30d6\u30e9\u30a6\u30b6\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u5229\u7528\u3059\u308b\u305f\u3081\u9ad8\u901f\u306a\u51e6\u7406\u306b\u306a\u308a\u307e\u3059<\/li>\n<\/ul>\n<h2>\u4e0a\u8a18\u3092\u8e0f\u307e\u3048\u3066\u5909\u66f4<\/h2>\n<pre class=\"lang:default decode:true\">server {\r\n     listen 80;\r\n     # \u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u306aIP\u30a2\u30c9\u30ec\u30b9\u3001\u3082\u3057\u304f\u306f\u30c9\u30e1\u30a4\u30f3\r\n     server_name 192.168.11.27;\r\n     root \/var\/www\/html;\r\n     index index.html;\r\n     proxy_set_header X-Real-IP $remote_addr;\r\n     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n     proxy_set_header Host $http_host;\r\n     proxy_redirect off;\r\n     proxy_max_temp_file_size 0;\r\n\r\n     sendfile off;\r\n     etag off;\r\n     if_modified_since off;\r\n\r\n     location \/ {\r\n        expires -1;\r\n        proxy_pass http:\/\/localhost:8000;\r\n     }\r\n}\r\n\r\n\r\nserver {\r\n     listen 8000;\r\n     server_name localhost;\r\n     root \/var\/www\/html;\r\n     index index.html;\r\n\r\n     add_header Cache-Control no-cache;\r\n     sendfile off;\r\n     etag off;\r\n     if_modified_since off;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u5224\u5b9a<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14428img-responsive\" src=\"https:\/\/sys-guard.com\/contents\/wp-content\/uploads\/2017\/06\/nginx_no_cache_20170623_2.png\" alt=\"\" width=\"656\" height=\"650\" \/><\/p>\n<p>\u3044\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>no-cache\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3060\u3051\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u306a\u3044\u3002<\/h2>\n<pre class=\"lang:default decode:true  \">server {\r\n     listen 80;\r\n     server_name 192.168.11.27;\r\n     root \/var\/www\/html;\r\n     index index.html;\r\n\r\n\r\n    location \/no-cache\/ {\r\n\r\n        add_header Cache-Control no-cache; #\u203bCDN\u306e\u7a2e\u985e\u306b\u3088\u3063\u3066\u306fno-cache\u3092private\u306b\u5909\u3048\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\r\n\r\n        sendfile off;\r\n        etag off;\r\n        if_modified_since off;\r\n\r\n    }\r\n\r\n}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u30ad\u30e3\u30c3\u30b7\u30e5\u306f\u4fbf\u5229\u3060\u3051\u308c\u3069\u3001\u6016\u3044<\/h3>\n<p>Nginx\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u6a5f\u69cb\u3092\u63a1\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u7d76\u5bfe\u306b\u7ba1\u7406\u753b\u9762\u7cfb\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093\u3057\u3001\u305d\u306e\u5834\u5408\u306f\u5c11\u3057\u30b3\u30f3\u30d5\u30a3\u30b0\u304c\u8907\u96d1\u306b\u306a\u308a\u307e\u3059\u3002\u5229\u7528\u6642\u306f\u5fc5\u8981\u306a\u90e8\u5206\u3060\u3051\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u6dfb\u3048\u3066\u3001\u5b89\u5168\u306b\u5229\u7528\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u307e\u305f\u3001\u5192\u982d\u306e\u67d0\u30d5\u30ea\u30de\u30b5\u30fc\u30d3\u30b9\u306e\u30b1\u30fc\u30b9\u306b\u623b\u308a\u307e\u3059\u304c\u3001\u65b0\u305f\u306aCDN\u3092\u3046\u307e\u304f\u4f7f\u3046\u306b\u306f<\/p>\n<pre class=\"lang:default decode:true\">\u00d7 Cache-Control no-cache;<\/pre>\n<pre class=\"lang:default decode:true\">\u25cb Cache-Control private;<\/pre>\n<p><strong>private\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u3068\u30da\u30fc\u30b8\u3092\u30ad\u30e3\u30c3\u30b7\u30e5<\/strong>\u3057\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u4ed5\u69d8\u3060\u3063\u305f\u6a21\u69d8\u3067\u3059\u3002<strong>\u306a\u306b\u3053\u308c\u6016\u3044\uff01<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h3>\u6280\u8853\u7684\u306a\u5931\u6557\u4f8b\u3092\u6559\u3048\u3066\u8cb0\u3048\u308b\u306e\u306f\u3068\u3066\u3082\u6709\u96e3\u3044(\u3181\u1d17\u3181\u273f)<\/h3>\n<p>\u30c8\u30e9\u30d6\u30eb\u3084\u5931\u6557\u4f8b\u306b\u5b66\u3076\u3053\u3068\u3063\u3066\u52c9\u5f37\u306b\u306a\u308a\u307e\u3059\u3002\u982d\u306e\u4e2d\u306b\u5931\u6557\u4f8b\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u3063\u3066\u304a\u304f\u3068\u3001\u81ea\u8eab\u304c\u7ba1\u7406\u3059\u308b\u30b7\u30b9\u30c6\u30e0\u306e\u969c\u5bb3\u304c\u8d77\u3053\u3063\u305f\u6642\u306b\u3001\u969c\u5bb3\u306e\u4e88\u6e2c\u304c\u901f\u304f\u306a\u308a\u307e\u3059\u3057\u3001\u5931\u6557\u4f8b\u306b\u9665\u308b\u30a2\u30f3\u30c1\u30d1\u30bf\u30fc\u30f3\u306a\u30b7\u30b9\u30c6\u30e0\u3092\u7d44\u307e\u305a\u306b\u6e08\u307f\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h4>\u4eca\u56de\u306e\u30b1\u30fc\u30b9\u306e\u6559\u8a13\u3068\u3057\u3066<\/h4>\n<p>\u5916\u90e8\u30b5\u30fc\u30d3\u30b9\u3092\u5909\u66f4\u3059\u308b\u5834\u5408\u306f\u3001\u305d\u306e\u30b5\u30fc\u30d3\u30b9\u306e\u4ed5\u69d8\u306e\u7d30\u304b\u3044\u628a\u63e1\u304c\u5fc5\u8981\u3067\u3042\u308b\u3053\u3068\u3001\u691c\u8a3c\u3092\u91cd\u306d\u3066\u884c\u306a\u308f\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002\u8a00\u3046\u306e\u306f\u7c21\u5358\u3067\u3059\u304c\u3002<\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67d0\u30d5\u30ea\u30de\u30b5\u30fc\u30d3\u30b9\u306e\u30b7\u30b9\u30c6\u30e0\u5909\u66f4\u306e\u969b\u306b\u3001CDN\u306e\u4ed5\u69d8\u628a\u63e1\u3092\u8aa4\u3063\u305f\u70ba\u306b\u3001\u4f1a\u54e1\u60c5\u5831\u3092CDN\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u3066\u3057\u307e\u3044\u3001\u8cfc\u5165\u5c65\u6b74\u3001\u4f4f\u6240\u3084\u30af\u30ec\u30ab\u60c5\u5831\u306e\u4e00\u90e8\u3068\u3044\u3063\u305f\u4f1a\u54e1\u306e\u500b\u4eba\u60c5\u5831\u3092\u6f0f\u3048\u3044\u3057\u3066\u3057\u307e\u3063\u305f\u4e8b\u6545\u304c\u5148\u65e5\u3042\u308a\u307e\u3057\u305f\u3002 \u305d\u3053\u3067\u4eca\u56de\u306fNginx\u306e\u57fa\u672c\u7684\u306a\u30ad\u30e3\u30c3\u30b7\u30e5\u30b3 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5168,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,26],"tags":[125],"_links":{"self":[{"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/posts\/14426"}],"collection":[{"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/comments?post=14426"}],"version-history":[{"count":0,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/posts\/14426\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/media\/5168"}],"wp:attachment":[{"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/media?parent=14426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/categories?post=14426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/tags?post=14426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}