{"id":1343,"date":"2011-02-08T20:31:54","date_gmt":"2011-02-08T11:31:54","guid":{"rendered":"http:\/\/mk.miko.jp\/blog\/?p=1343"},"modified":"2011-03-09T07:56:11","modified_gmt":"2011-03-08T22:56:11","slug":"nginx%e3%81%a7%e7%b0%a1%e5%8d%98%e3%81%aa%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%9b%e3%82%b9%e3%83%88%e3%82%92%e7%ab%8b%e3%81%a6%e3%81%9f","status":"publish","type":"post","link":"http:\/\/mk.miko.jp\/blog\/archives\/1343","title":{"rendered":"Nginx\u3067\u7c21\u5358\u306a\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u3092\u7acb\u3066\u305f"},"content":{"rendered":"<p>\u3000\u3084\u3063\u3071\u8a66\u3057\u305f\u3044\u3093\u3067\u3001PHP\u629c\u304d\u306e\u5358\u7d14\u306a\u5974\u3092\u7acb\u3066\u3066\u307f\u305f\u3002Lighttpd+mod_simple_vhost\u304b\u3089\u7f6e\u304d\u63db\u3048\u3084\u3059\u3044\u3088\u3046\u306b\u3001\/srv\/www\/vhosts\u306e\u4e0b\u306b\u30db\u30b9\u30c8\u540d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3084\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u7f6e\u304f\u3060\u3051\u306e\u5f62\u306b\u3057\u3066\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u30b5\u30fc\u30d0\u306f\u30a2\u30af\u30bb\u30b9\u7981\u6b62\u3067\u3002<br \/>\n\u3000nginx.conf\u306eserver\u30d6\u30ed\u30c3\u30af\u306f\u3053\u3093\u306a\u3093\u3002<\/p>\n<pre class=\"brush:plain\">    server {\r\n        deny all;\r\n    }\r\n    server {\r\n        server_name ~\\.[a-zA-Z]+\\.?$;\r\n        root \/srv\/www\/vhosts\/$host;\r\n        index index.php index.html index.htm;\r\n        location ~ \/\\.ht {\r\n            deny all;\r\n        }\r\n    }<\/pre>\n<p>\u3000\u3053\u306e\u7a0b\u5ea6\u3067\u666e\u901a\u306b\u52d5\u304f\u3002\u4e00\u898b\u3002\u5b9a\u6570\u3092\u9003\u304c\u3057\u305f\u308a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u5b58\u5728\u3092\u5224\u5b9a\u3057\u305f\u308a\u3059\u308c\u3070\u3001\u3082\u3063\u3068mod_simple_vhost\u4e92\u63db\u3063\u307d\u304f\u306a\u308a\u305d\u3046\u3002\u5225\u306b\u8981\u3089\u306a\u3044\u3051\u3069\u3002<br \/>\n\u3000\u4e00\u3064\u76ee\u306eserver\u30d6\u30ed\u30c3\u30af\u3067\u30c7\u30d5\u30a9\u30eb\u30c8\u30b5\u30fc\u30d0\u3092\u62fe\u3063\u3066\u3001\u4e8c\u3064\u76ee\u306eserver\u30d6\u30ed\u30c3\u30af\u3067FQDN\u3063\u307d\u3044\u30db\u30b9\u30c8\u540d\u3092\u5168\u90e8\u62fe\u3063\u3066\u3044\u308b\u3002server_name\u306e\u3057\u3087\u307c\u3044RE\u304c\u305d\u306e\u5224\u5b9a\u3002\u3082\u3063\u3068\u30de\u30b7\u306aRE\u306f\u7121\u3044\u306e\u304b\u3002<br \/>\n\u3000root\u306e\u3068\u3053\u306f\u826f\u304f\u898b\u308b\u66f8\u304d\u65b9\u3002$host\u306f\u57fa\u672c\u7684\u306bHost\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u3092\u62fe\u3063\u3066\u304f\u308b\u306e\u3067\u3001<\/p>\n<pre class=\"brush:plain\">GET \/shadow HTTP\/1.0\r\nHost: ..\/..\/..\/etc<\/pre>\n<p>\u307f\u305f\u3044\u306a\u304b\u3063\u3053\u3044\u3044\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u3063\u305f\u3089\u3069\u3046\u306a\u308b\u304b\u6c17\u306b\u306a\u3063\u305f\u3051\u3069\u3001\u666e\u901a\u306b400\u304c\u8fd4\u3063\u3066\u304d\u305f\u306e\u3067\u5b89\u5fc3\u3057\u305f\u3002\u3061\u306a\u307f\u306bLighttpd+mod_simple_vhost\u3067\u3082400\u3002<code>..\/vhosts\/foo<\/code>\u307f\u305f\u3044\u306b\u66f8\u3044\u3066\u3082400\u3002<br \/>\n\u3000\u4ed6\u306b\u3061\u3087\u3063\u3068\u3044\u3058\u3063\u305f\u3068\u3053\u306e\u5dee\u5206\u3092\u307e\u3068\u3081\u308b\u3068\u3001<\/p>\n<pre class=\"brush:plain\">    log_format main '$remote_addr $host - #\u4ee5\u4e0b\u7565\r\n    tcp_nopush on;\r\n    server_name_in_redirect off;\r\n    server_tokens off;<\/pre>\n<p>\u3053\u3093\u306a\u3082\u3093\u3002<br \/>\n\u3000log_format\u306f$host\u3092\u57cb\u3081\u305f\u3060\u3051\u3002<br \/>\n\u3000tcp_nopush\u306f\u591a\u5206TCP\u30d1\u30b1\u30c3\u30c8\u9001\u4fe1\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u6700\u9069\u5316\u3060\u3051\u3069\u3001FreeBSD\u3060\u3068buggy\u3060\u3068\u304b\u66f8\u3044\u3066\u3042\u3063\u305f\u3002Linux\u3060\u3057\u3044\u3044\u3093\u3058\u3083\u306d\u3002\u77e5\u3089\u3093\u3051\u3069\u3002TAF\u3068\u304b\u3075\u3064\u30fc0\u3067\u3059\u3057\u306d\u30b2\u30fc\u30de\u30fc\u7684\u306b\u3002\u305d\u308c\u306f\u5fae\u5999\u306b\u9055\u3046\u8a71\u3067\u3059\u306d\u3002<br \/>\n\u3000server_name_in_redirect\u306f\u4f55\u3068\u306a\u304f\u3002UseCanonicalName On\u306b\u3044\u3044\u601d\u3044\u51fa\u304c\u7121\u3044\u306e\u3067\u3002\u591a\u5206\u3069\u3046\u3067\u3082\u3044\u3044\u3002\u3080\u3057\u308d\u9593\u9055\u3063\u305f\u9078\u629e\u304b\u3082\u3057\u308c\u306a\u3044\u3002<br \/>\n\u3000server_tokens\u306f\u666e\u901a\u306boff\u3067\u3044\u3044\u3093\u3058\u3083\u306d\u3002<\/p>\n<p>\u3000\u3067\u3001\u3053\u306e\u307e\u307e\u5b9f\u9a13\u7d42\u4e86\u3067\u3082\u3044\u3044\u3051\u3069\u3001\u3069\u3046\u305b\u306a\u3089PHP\u3082\u8d70\u3089\u305b\u3066\u307f\u308b\u304b\u306a\u3042\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3082\u3093\u304c\u6025\u306b\u5897\u3048\u308b\u3051\u3069\u3001PHP-FPM\u7acb\u3066\u308b\u307e\u3067\u306e\u624b\u9593\u306f\u5927\u3057\u305f\u3053\u3068\u7121\u3044\u3057\u3002<br \/>\n\u3000\u3042\u3001CGI\u3060\u3051Lighttpd\u304bApache\u306b\u6d41\u3059\u624b\u3082\u3042\u308b\u304b\u3082\u3002\u305d\u3057\u305f\u3089\u30e1\u30a4\u30f3\u30b5\u30fc\u30d0\u3067\u666e\u901a\u306bNginx\u884c\u3051\u308b\u304b\u3082\u3002<br \/>\n\u3000\u3064\u30fc\u304bApache\u306b\u6d41\u3059\u306a\u3089mod_php\u3082\u4f7f\u3048\u308b\u306a\u3042\u3002\u6709\u5229\u304b\u3069\u3046\u304b\u306f\u5206\u304b\u3089\u3093\u3051\u3069\u3002<\/p>\n<p>\u3000\u3066\u3044\u3046\u304b\u305d\u308cLighttpd\u3060\u3051\u3067\u3044\u3044\u3093\u3058\u3083\u306d\uff1f<br \/>\n\u3000\u3066\u3044\u3046\u304b\u8a71\u304c\u30eb\u30fc\u30d7\u3057\u3066\u306d\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u3084\u3063\u3071\u8a66\u3057\u305f\u3044\u3093\u3067\u3001PHP\u629c\u304d\u306e\u5358\u7d14\u306a\u5974\u3092\u7acb\u3066\u3066\u307f\u305f\u3002Lighttpd+mod_simple_vhost\u304b\u3089\u7f6e\u304d\u63db\u3048\u3084\u3059\u3044\u3088\u3046\u306b\u3001\/srv\/www\/vhosts\u306e\u4e0b\u306b\u30db\u30b9\u30c8\u540d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3084\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u7f6e\u304f\u3060\u3051 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/posts\/1343"}],"collection":[{"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/comments?post=1343"}],"version-history":[{"count":0,"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/posts\/1343\/revisions"}],"wp:attachment":[{"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/media?parent=1343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/categories?post=1343"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mk.miko.jp\/blog\/wp-json\/wp\/v2\/tags?post=1343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}