{"id":4829,"date":"2014-12-11T09:00:20","date_gmt":"2014-12-11T00:00:20","guid":{"rendered":"http:\/\/www.vincentina.net\/?p=4829"},"modified":"2014-12-11T05:05:11","modified_gmt":"2014-12-10T20:05:11","slug":"dockerchef%e3%81%a7%e7%92%b0%e5%a2%83%e4%bd%9c%e3%82%8a%e3%80%80%ef%bc%91","status":"publish","type":"post","link":"https:\/\/www.vincentina.net\/?p=4829","title":{"rendered":"Docker+Chef\u3067\u74b0\u5883\u4f5c\u308a\u3000\uff11 PHP\/Nginx"},"content":{"rendered":"<p>\u524d\u56de\u306e<a href=\"http:\/\/www.vincentina.net\/?p=4820\" rel=\"bookmark\">Docker + Chef \u3067\u697d\u3005\u74b0\u5883\u4f5c\u308a<\/a>\u304b\u3089\u306e\u7d9a\u304d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7269\u4e8b\u306b\u306f\u9806\u5e8f\u3068\u3044\u3046\u3082\u306e\u304c\u5fc5\u8981\u306a\u306e\u3067\u3001Chef\u5b9f\u8df5\u5165\u9580\u3092\u53c2\u8003\u306b\u3057\u3064\u3064\u3001PHP\u74b0\u5883\uff5eApache\u3068\u9032\u3093\u3067\u304b\u3089Sinatra\u3092\u30fb\u30fb\u3068\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u66f8\u7c4d\u306e\u65b9\u3067\u306fVagrant\u3068Virtualbox\u3068Chef\u306a\u3093\u3067\u3059\u304c\u3001\u3084\u3063\u3071\u308aDocker\u3068Chef\u3067\u9032\u3081\u307e\u3059\u3002<\/p>\n<h1>Capstrano\u3068\u304b<\/h1>\n<p>\u3053\u3046\u3044\u3046\u81ea\u52d5\u5316\u306a\u4e8b\u67c4\u3092\u8abf\u3079\u3066\u9032\u3081\u3066\u3044\u308b\u3068\u3001Capistrano\u3068Fabric\u3068\u3044\u3046\u3082\u306e\u304c\u6700\u8fd1\u76ee\u306b\u3064\u304f\u3088\u3046\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002Capstrano\u3067\u4f55\u304c\u3067\u304d\u308b\u306e\u304b\u3068\u3044\u3046\u3068\u3001\u3053\u306a\u3044\u3060<a title=\"\u30a4\u30d9\u30f3\u30c8\u60c5\u5831\u53ce\u96c6\u30a2\u30d7\u30ea\u304c\u3060\u3044\u305f\u3044\u51fa\u6765\u4e0a\u304c\u3063\u305f\u306e\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u30d5\u30a9\u30a4\" href=\"http:\/\/www.vincentina.net\/?p=4786\" target=\"_blank\">Sinatra\u3067\u30a4\u30d9\u30f3\u30c8\u53ce\u96c6\u30a2\u30d7\u30ea<\/a>\u3092\u4f5c\u6210\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u672c\u756a\u30b5\u30fc\u30d0\u30fc\u3067\u53ef\u52d5\u3055\u305b\u308b\u307e\u3067\u306e\u5de5\u7a0b\u304c<\/p>\n<p>\u30fb\u30ed\u30fc\u30ab\u30eb\u3067\u30a2\u30d7\u30ea\u3092\u4f5c\u6210<br \/>\n\u30fbGithub\u306b\u30a2\u30c3\u30d7<br \/>\n\u30fb\u672c\u756a\u74b0\u5883\u3067Github\u304b\u3089Clone<br \/>\n\u30fb\u672c\u756a\u30b5\u30fc\u30d0\u30fc\u3067\u3061\u3087\u3053\u3061\u3087\u3053\u66f8\u304d\u76f4\u3057<br \/>\n\u30fb\u51fa\u6765\u4e0a\u304c\u308a\uff01<\/p>\n<p>\u3068\u3044\u3046\u6d41\u308c\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u30c7\u30d7\u30ed\u30a4\u307e\u3067\u306e\u5de5\u7a0b\u3092\u81ea\u52d5\u5316\u3057\u3066\u304f\u308c\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\n\u30c7\u30d7\u30ed\u30a4\u30c4\u30fc\u30eb\u3063\u3066\u66f8\u3044\u3066\u3042\u308b\u306e\u3092\u898b\u3066\u306a\u308b\u307b\u3069\u3068\u5408\u70b9\u304c\u3044\u304d\u307e\u3057\u305f\u3002<\/p>\n<h1>\u80b2\u3066\u308b<\/h1>\n<p>\u524d\u56de\u4f5c\u3063\u305fBase\u30ec\u30b7\u30d4\u3092\u80b2\u3066\u3066\u3044\u304f\u611f\u3058\u3067\u3059\u306d\u3002<\/p>\n<p>\u307e\u3060\u307e\u3060\u4f7f\u3048\u305f\u3082\u3093\u3058\u3083\u306a\u3044\u3067\u3059\u304c\u30ea\u30f3\u30af\u3060\u3051\u3002<br \/>\n<a href=\"https:\/\/github.com\/takekentw\/chef-docker_base\" target=\"_blank\">https:\/\/github.com\/takekentw\/chef-docker_base<\/a><\/p>\n<h1>\u3084\u3063\u3071ssh\u3067\u7e4b\u304c\u308a\u305f\u3044<\/h1>\n<p>\u524d\u56de\u306f\u300c\u30b3\u30f3\u30c6\u30ca\u3060\u3057\u3001\/bin\/bash\u3067\u30b3\u30f3\u30c6\u30ca\u3092run\u3057\u305f\u65b9\u304c\u3044\u3044\u304b\u306a\u300d\u3068\u601d\u3063\u305f\u3093\u3067\u3059\u304c\u3001\u6700\u7d42\u7684\u306b\u306fssh\u3067\u7e4b\u304e\u305f\u3044\u306a\u3041\u3068\u601d\u3063\u305f\u306e\u3067\u307e\u305a\u306f\u305d\u3053\u304b\u3089\u4fee\u6b63\u304b\u3002<\/p>\n<p>\u65b9\u6cd5\u306f2\u901a\u308a\u3002\u30dd\u30fc\u30c8\u756a\u53f7\u3092\u6307\u5b9a\u3059\u308b\u304b\u3001pipework\u3092\u4f7f\u3063\u3066IP\u30a2\u30c9\u30ec\u30b9\u3092\u5272\u308a\u632f\u308b\u304b\u3002<br \/>\n\u524d\u8005\u3001\u5f8c\u8005\u3068\u3082\u3001\u3069\u3061\u3089\u306b\u3057\u308d\u8d70\u3089\u305b\u305f\u5f8c\u306b\u30b3\u30f3\u30c6\u30caID\u3092\u78ba\u8a8d\u3059\u308b\u304b\u3001\u30dd\u30fc\u30c8\u756a\u53f7\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3044\u3046\u884c\u70ba\u306f\u5fc5\u8981\u304b\u3068\u601d\u3046\u306e\u3067\uff08\u5168\u81ea\u52d5\u3082\u3042\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001\u4eca\u306f\u77e5\u3089\u306a\u3044\uff09\u3001\u524d\u8005\u3067\u3044\u3044\u304b\u306a\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3068\u3053\u308d\u3092\u30ec\u30b7\u30d4\u306b\u8ffd\u8a18\u3057\u3066\u3001\u65b0\u3057\u304f\u4f5c\u3063\u305f\u3082\u306e\u3067\u3082\u3044\u3044\u3057\u3001\u30d9\u30fc\u30b9\u306e\u30ec\u30b7\u30d4\u3067\u3082\u3044\u3044\u3057\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">service &quot;sshd&quot; do\r\n supports status: true, restart: true, reload: true\r\n action &#x5B;:enable, :start]\r\n end<\/pre>\n<p>sshd\u3092\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3059\u308c\u3070OK\u3067\u3059\u3002<br \/>\n\u7121\u7406\u3060\u3063\u305f\u3089\u3069\u3053\u304b\u9593\u9055\u3048\u3066\u3044\u308b\u3068\u601d\u308f\u308c\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ sudo docker run -d -p 22 base:latest \/usr\/sbin\/sshd-D\r\n$ ssh -p 49153 localhost\r\nThe authenticity of host '&#x5B;localhost]:49153 (&#x5B;::1]:49153)' can't be established.\r\nRSA key fingerprint is 9f:e8:4e:ed:28:8f:ce:22:4a:c6:00:15:10:f0:72:a8.\r\nAre you sure you want to continue connecting (yes\/no)? yes\r\nWarning: Permanently added '&#x5B;localhost]:49153' (RSA) to the list of known hosts.\r\ntakeken@localhost's password:\r\nLast login: Tue Dec\u00a0 9 11:13:58 2014 from 172.17.42.1\r\n<\/pre>\n<p>\u7121\u7406\u3060\u3063\u305f\u5834\u5408\u3001\u4e00\u756a\u7c21\u5358\u306a\u78ba\u8a8d\u65b9\u6cd5\u306f\u30aa\u30fc\u30bd\u30c9\u30c3\u30af\u30b9\u306b\/bin\/bash\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u3063\u3066\u3001\u30b7\u30a7\u30eb\u3067\u30b3\u30f3\u30c6\u30ca\u306e\u4e2d\u306e\u72b6\u614b\u3092\u78ba\u8a8d\u3059\u308b\u306e\u304c\u9060\u56de\u308a\u3067\u3082\u9060\u56de\u308a\u3058\u3083\u306a\u3044\uff01\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u6163\u308c\u3066\u3044\u308b\u4eba\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u898b\u76f4\u3057\u306b\u306a\u308b\u306e\u3060\u308d\u3046\u3051\u308c\u3069\u306d\u3002<\/p>\n<h2>ifconfig\u30ea\u30bd\u30fc\u30b9\u3067IP\u30a2\u30c9\u30ec\u30b9\u306f\u6307\u5b9a\u3067\u304d\u308b\u306e\u304b<\/h2>\n<p>Docker\u306f\u72ec\u81ea\u306e\u65b9\u6cd5\u3067172.17.0.0\/16\u306eIP\u30a2\u30c9\u30ec\u30b9\u3092\u5272\u308a\u632f\u3063\u3066\u3044\u308b\u3088\u3046\u306a\u306e\u3067\u3001\u30ec\u30b7\u30d4\u3067\u632f\u3063\u305f\u3068\u3057\u3066\u3082\u7121\u7406\u3060\u3068\u601d\u3044\u307e\u3059\u3002\u500b\u4eba\u3067\u30b3\u30f3\u30c6\u30ca\u306b\u8a2d\u5b9a\u3059\u308b\u304b\u3001pipework\u3092\u4f7f\u3046\u306e\u304c\u826f\u3055\u3052\u3067\u3059\u3002<\/p>\n<h1>\u307e\u305a\u306fPHP\u306a\u74b0\u5883\u304b\u3089<\/h1>\n<p>\u307e\u305a\u306fPHP+Nginx\u306a\u74b0\u5883\u304b\u3089\u3002\u3044\u3063\u3061\u3070\u30fc\u3093\u6700\u521d\u306bChef\u3092\u89e6\u3063\u305f\u3068\u304d\u306bNginx\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306f\u5931\u6557\u3057\u307e\u3057\u305f\u304c\u3001\u3069\u3046\u3084\u3089\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u30af\u30c3\u30af\u30d6\u30c3\u30af\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u3063\u305f\u3088\u3046\u3067\u3059\u3002\u306a\u308b\u307b\u3069\u306d\u3002<br \/>\n\u5f8c\u306f\u3001\u3053\u3053\u304b\u3089\u306f\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306e\u60c5\u5831\u3060\u3051\u3067\u306f\u306a\u304f\u3066\u3001\u66f8\u7c4d\u306e\u5185\u5bb9\u3082\u5165\u3063\u3066\u304f\u308b\u306e\u3067\u7aef\u6298\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8a73\u7d30\u306f\u6280\u8a55\u3055\u3093\u306e\u30b5\u30a4\u30c8\u3082\u53c2\u7167\u304f\u3060\u3057\u3042\u3002<br \/>\n<a href=\"http:\/\/gihyo.jp\/book\" target=\"_blank\">\u6280\u8853\u8a55\u8ad6\u793e<\/a><br \/>\n\u66f8\u7c4d\u306b\u8f09\u3063\u3066\u3044\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u5168\u3066\u30cd\u30c3\u30c8\u3067\u516c\u958b\u3057\u3066\u3044\u308b\u3089\u3057\u3044\u306e\u3067\u3001\u305d\u3093\u306a\u6c17\u306b\u3059\u308b\u5fc5\u8981\u306f\u306a\u3044\u3068\u601d\u3046\u3051\u308c\u3069\u3001\u305d\u306e\u307e\u307e\u3063\u3066\u306e\u3082\u82b8\u304c\u306a\u3044\u3057\u306d\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;takeken@ubuntu]$ knife cookbook create nginx -o site-cookbooks\r\n** Creating cookbook nginx\r\n** Creating README for cookbook: nginx\r\n** Creating CHANGELOG for cookbook: nginx\r\n** Creating metadata for cookbook: nginx\r\n\r\n&#x5B;takeken@ubuntu]$ vim site-cookbooks\/nginx\/recipes\/default.rb<\/pre>\n<p>berks install &#8211;path \u306f\u30b3\u30de\u30f3\u30c9\u304c\u5909\u66f4\u306b\u306a\u3063\u3066\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;takeken@ubuntu]$ berks vendor cookbooks\r\nResolving cookbook dependencies...\r\nFetching 'nginx' from source at site-cookbooks\/nginx\r\nFetching cookbook index from https:\/\/supermarket.getchef.com...\r\nUsing nginx (0.1.0) from source at site-cookbooks\/nginx\r\nUsing selinux (0.8.0)\r\nUsing yum (3.5.1)\r\nInstalling yum-epel (0.5.3)\r\nVendoring nginx (0.1.0) to cookbooks\/nginx\r\nVendoring selinux (0.8.0) to cookbooks\/selinux\r\nVendoring yum (3.5.1) to cookbooks\/yum\r\nVendoring yum-epel (0.5.3) to cookbooks\/yum-epel<\/pre>\n<p><strong>chef-repo\/nodes\/docker.json<\/strong>\u3092\u7de8\u96c6\u3057\u3066\u52d5\u4f5c\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;takeken@ubuntu]$ cat chef-repo\/nodes\/docker.json\r\n{\r\n\u00a0&quot;run_list&quot; : &#x5B;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &quot;recipe&#x5B;yum]&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &quot;recipe&#x5B;yum-epel]&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &quot;nginx&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &quot;recipe&#x5B;selinux::disabled]&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &quot;recipe&#x5B;base]&quot;,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &quot;recipe&#x5B;nginx]&quot;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ]\r\n}<\/pre>\n<p>\u30d3\u30eb\u30c9\u304c\u5b8c\u4e86\u3059\u308b\u307e\u3067\u4f55\u6545\u304b\u3081\u3061\u3083\u304f\u3061\u3083\u6642\u9593\u304c\u304b\u304b\u3063\u305f\u3002<br \/>\n\u307e\u3060Nginx\u3092\u5165\u308c\u305f\u3060\u3051\u306a\u306e\u3067\u3001ssh\u3067\u5165\u3063\u3066nginx\u3092\u8d77\u52d5\u3057\u3066\u78ba\u8a8d\u3002<br \/>\n\u7d30\u304b\u3044\u7406\u7531\u306fDocker\u306e\u4ed5\u7d44\u307f\u306e\u4e8b\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.vincentina.net\/wp-content\/uploads\/2014\/12\/Chef01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vincentina.net\/wp-content\/uploads\/2014\/12\/Chef01.jpg\" alt=\"Chef01\" width=\"432\" height=\"228\" class=\"alignnone size-full wp-image-4833\" srcset=\"https:\/\/www.vincentina.net\/wp-content\/uploads\/2014\/12\/Chef01.jpg 432w, https:\/\/www.vincentina.net\/wp-content\/uploads\/2014\/12\/Chef01-300x158.jpg 300w\" sizes=\"auto, (max-width: 432px) 85vw, 432px\" \/><\/a><\/p>\n<p>\u7d9a\u3044\u3066php-fpm\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;takeken@ubuntu]$ knife cookbook create php-env -o site-cookbooks\r\n&#x5B;takeken@ubuntu]$ vi site-cookbooks\/php-env\/recipes\/default.rb\r\n&#x5B;takeken@ubuntu]$ vi nodes\/docker.json\r\n\u3000&quot;recipe&#x5B;php-env]&quot;\u00a0\u00a0\u00a0\u00a0 # \u8ffd\u52a0\u3057\u307e\u3059\u3002\r\n&#x5B;takeken@ubuntu]$ vi Berksfile\r\n\u3000cookbook 'php-env', path: &quot;.\/site-cookbooks\/php-env&quot;\u3000\uff03\u8ffd\u52a0\u3057\u307e\u3059\u3002\r\n\u30b3\u30df\u30e5\u30cb\u30c6\u30a3Cookbook\u3092\u6e96\u5099\u3002\r\n&#x5B;takeken@ubuntu]$ berks vendor cookbooks\r\nResolving cookbook dependencies...\r\nFetching 'nginx' from source at site-cookbooks\/nginx\r\nFetching 'php-env' from source at site-cookbooks\/php-env\r\nFetching cookbook index from https:\/\/supermarket.getchef.com...\r\nUsing nginx (0.1.0) from source at site-cookbooks\/nginx\r\nUsing php-env (0.1.0) from source at site-cookbooks\/php-env\r\nUsing selinux (0.8.0)\r\nUsing yum (3.5.1)\r\nUsing yum-epel (0.5.3)\r\nVendoring nginx (0.1.0) to .\/cookbooks\/nginx\r\nVendoring php-env (0.1.0) to .\/cookbooks\/php-env\r\nVendoring selinux (0.8.0) to .\/cookbooks\/selinux\r\nVendoring yum (3.5.1) to .\/cookbooks\/yum\r\nVendoring yum-epel (0.5.3) to .\/cookbooks\/yum-epel\r\n<\/pre>\n<p>\u3093\u3067\u3001\u30d3\u30eb\u30c9\u30fc\u3002<\/p>\n<p>\u304c\u7d42\u308f\u3063\u305f\u306e\u3067\u3001\u78ba\u8a8d\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;takeken@755acbdb1068 ~]$ php-fpm -v\r\nPHP 5.3.3 (fpm-fcgi) (built: Oct 30 2014 20:14:56)<\/pre>\n<p>\u307e\u3060nginx\u3068php\u3068\u306e\u8a2d\u5b9a\u304c\u3067\u304d\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u3053\u3053\u3067erb\u30d5\u30a1\u30a4\u30eb\u304c\u51fa\u3066\u304f\u308b\u306e\u3067\u3059\u304c\u3001nginx\u3082\u3044\u3064\u306e\u9593\u306b\u304b\uff08\u6700\u521d\u304b\u3089\u304b\u3082\uff09include\u3059\u308bconf\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u3063\u3066\u3044\u305f\u3002<\/p>\n<p>\u3053\u3044\u3064\u3092\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u3057\u3066\u3001erb\u3092\u4f5c\u3063\u3066\u3044\u304f\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">-rw-r--r-- 1 root root 1290 Nov 11 16:27 \/etc\/nginx\/conf.d\/default.conf\r\n\r\n--- chef-repo\/site-cookbooks\/nginx\/templates\/default\/default.conf.erb\u00a0\u00a0 2014-12-10 11:34:04.076380776 +0900\r\n+++ \/home\/takeken\/default.conf.etb\u00a0\u00a0\u00a0\u00a0\u00a0 2014-12-10 11:30:18.008380926 +0900\r\n@@ -37,15 +37,13 @@\r\n\r\n# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\r\n#\r\n-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;% if node&#x5B; 'nginx' ]&#x5B; 'env' ].include?(&quot;php&quot;) %&gt;\r\n-\u00a0\u00a0\u00a0 location ~ \\.php$ {\r\n+\u00a0\u00a0\u00a0 #location ~ \\.php$ {\r\n#\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 html;\r\n-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_pass\u00a0\u00a0 127.0.0.1:9000;\r\n-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_index\u00a0 index.php;\r\n-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_param\u00a0 SCRIPT_FILENAME\u00a0 $document_root$fastcgi_script_name;\r\n-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 include\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_params;\r\n-\u00a0\u00a0\u00a0 }\r\n-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;% end %&gt;\r\n+\u00a0\u00a0\u00a0 #\u00a0\u00a0\u00a0 fastcgi_pass\u00a0\u00a0 127.0.0.1:9000;\r\n+\u00a0\u00a0\u00a0 #\u00a0\u00a0\u00a0 fastcgi_index\u00a0 index.php;\r\n+\u00a0\u00a0\u00a0 #\u00a0\u00a0\u00a0 fastcgi_param\u00a0 SCRIPT_FILENAME\u00a0 \/scripts$fastcgi_script_name;\r\n+\u00a0\u00a0\u00a0 #\u00a0\u00a0\u00a0 include\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_params;\r\n+\u00a0\u00a0\u00a0 #}\r\n\r\n# deny access to .htaccess files, if Apache's document root\r\n# concurs with nginx's one\r\n\r\nchef-repo\/site-cookbooks\/nginx\/recipes\/default.rb\u306btemplate\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u8ffd\u52a0\u3002\r\n\r\ntemlate 'default.conf' do\r\npath '\/etc\/nginx\/conf.d\/default.conf'\r\nsource &quot;default.conf.erb&quot;\r\nowner 'root'\r\ngroup 'root'\r\nmode '0644'\r\nnotifies :reload, &quot;service&#x5B;nginx]&quot;\r\nend\r\n<\/pre>\n<p>\u4f55\u56de\u3084\u3063\u3066\u3082\u4e0a\u624b\u304f\u3044\u304b\u305a\u3001\u7406\u7531\u306f\u4e0a\u306e\u30ec\u30b7\u30d4\u3092\u898b\u308b\u3068\u5206\u304b\u308b\u306e\u3067\u3059\u304c\u3001\u30ea\u30bd\u30fc\u30b9\u306etemplate\u304ctemlate\u306b\u306a\u3063\u3066\u307e\u3057\u305f\u3002<br \/>\n\u305d\u308a\u3083\u3042\u8aad\u307e\u305a\u3001\u8aad\u307e\u305b\u305a\u306a\u8a33\u3060\u3002\uff3c(^o^)\uff0f<br \/>\n\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u8a33\u3058\u3083\u306a\u3044\u3088\u3063\u3066\u306e\u306f\u52c9\u5f37\u306b\u306a\u3063\u305f\u3002<\/p>\n<p>\u3053\u306e\u8fba\u3067Attribute\u304c\u51fa\u3066\u304d\u307e\u3059\u3002Sinatra\u3067\u3082\u51fa\u3066\u304d\u3066\u3044\u305f&lt;%\u00a0 &gt;\u5185\u3092\u8aad\u307e\u305b\u308b\u30a2\u30ec\u3067\u3059\u3002<\/p>\n<p>erb\u3092\u7528\u610f\u3057\u3066\u30ec\u30b7\u30d4\u3092\u66f8\u304d\u63db\u3048\u305f\u3089\u3001Docker.json\u306b\u8ffd\u8a18\u3057\u3066\u3001Attribute\u30d5\u30a1\u30a4\u30eb\u3092\u66f8\u3044\u3066\u3001\u6700\u5f8c\u306bberks\u3092\u53e9\u3044\u3066\u30d3\u30eb\u30c9\u3067\u3059\u304b\u306a\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;takeken@ubuntu]$ cat chef-repo\/nodes\/docker.json\r\n{\r\n&quot;nginx&quot;:{\r\n&quot;env&quot;:&#x5B;&quot;php&quot;]\r\n},\r\n\r\n&quot;run_list&quot; : &#x5B;\r\n&quot;recipe&#x5B;yum]&quot;,\r\n&quot;recipe&#x5B;yum-epel]&quot;,\r\n&quot;nginx&quot;,\r\n&quot;recipe&#x5B;selinux::disabled]&quot;,\r\n&quot;recipe&#x5B;base]&quot;,\r\n&quot;recipe&#x5B;nginx]&quot;,\r\n&quot;recipe&#x5B;php-env]&quot;\r\n]\r\n}\r\n\r\n$ berks vendor cookbooks <\/pre>\n<p>\u51fa\u6765\u305f\u30b3\u30f3\u30c6\u30ca\u304c\u2193\u3053\u308c\u3067\u3059\u3002ssh\u3092\u8d77\u52d5\u3057\u3066\u30ed\u30b0\u30a4\u30f3\u3068\u3044\u3046\u624b\u9593\u304c\u9762\u5012\u306a\u306e\u3067Docker run\u3067\u30b7\u30a7\u30eb\u3092\u8d77\u52d5\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3055\u3063\u304d\u3082\u66f8\u3044\u305f\u901a\u308atemplate\u30ea\u30bd\u30fc\u30b9\u304ctemlate\u306b\u306a\u3063\u3066\u3044\u3066\u4f55\u56de\u3082\u5931\u6557\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001conf\u30d5\u30a1\u30a4\u30eb\u3078\u306einclude \u306b\u554f\u984c\u304c\u3042\u308b\u306e\u304b\u3068\u601d\u3044\u9055\u3044\u3057\u3066nginx.conf\u306b\u66f8\u304d\u76f4\u3057\u305f\u306e\u3067\u3055\u3063\u304d\u306e\u4f8b\u3068\u306f\u7570\u306a\u3063\u3066\u3044\u307e\u3059(\u00b4\u30fb\u03c9\u30fb`)<br \/>\n\u3053\u308c\u304c\u624b\u5165\u529b\u306e\u6016\u3055\u3060\u306d\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">bash-4.1# tail \/etc\/nginx\/nginx.conf\r\nroot\u00a0\u00a0 \/usr\/share\/nginx\/html;\r\n}\r\nlocation ~ \\.php$ {\r\nfastcgi_pass\u00a0\u00a0 127.0.0.1:9000;\r\nfastcgi_index\u00a0 index.php;\r\nfastcgi_param\u00a0 SCRIPT_FILENAME\u00a0 $document_root$fastcgi_script_name;\r\ninclude\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fastcgi_params;\r\n}\r\n}\r\n}<\/pre>\n<p>\u66f8\u7c4d\u3060\u3068\u30d7\u30ed\u30d3\u30b8\u30e7\u30cb\u30f3\u30b0\u3001\u3053\u3053\u3067\u306fDocker build\u306e\u3053\u3068\u3067\u3001\u3069\u3063\u3061\u3082Chef-solo\u304c\u8d70\u3063\u3066\u3044\u308b\u306e\u3067\u540c\u3058\u4e8b\u306a\u306e\u3067\u30ed\u30b0\u306e\u78ba\u8a8d\u306f\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067php\u3068nginx\u306e\u74b0\u5883\u4f5c\u308a\u307e\u3067\u7d42\u308f\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;takeken@ubuntu]$ ssh 172.17.0.69\r\ntakeken@172.17.0.69's password:\r\nLast login: Wed Dec 10 09:01:51 2014 from 172.17.42.1\r\n&#x5B;takeken@367ed09b5de0 ~]$ php -v\r\nPHP 5.3.3 (cli) (built: Oct 30 2014 20:12:53)\r\nCopyright (c) 1997-2010 The PHP Group\r\nZend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies\r\nwith Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies\r\n&#x5B;takeken@367ed09b5de0 ~]$ nginx -v\r\nnginx version: nginx\/1.0.15<\/pre>\n<p>\u3053\u3053\u3089\u3067git\u306e\u66f4\u65b0\u3067\u3082\u3057\u3066\u304a\u304d\u307e\u3059\u3002\u88cf\u3067\u306f\u968f\u5206\u3068\u5931\u6557\u3057\u3066\u3044\u308b\u306e\u3067git\u306e\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u306f\u3051\u3063\u3053\u3046\u4f7f\u3063\u3066\u3044\u307e\u3059\u30fb\u30fb\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;takeken@ubuntu]$ git add .\r\n&#x5B;takeken@ubuntu]$ git commit -m &quot;20141210:nginx\/php&quot;\r\n&#x5B;takeken@ubuntu]$ git push<\/pre>\n<p>&nbsp;<\/p>\n<p>\u53c2\u8003\u66f8\u7c4d<\/p>\n<p>Chef\u5b9f\u8df5\u5165\u9580\u3000\u6280\u8853\u8a55\u8ad6\u793e<\/p>\n<p>&nbsp;<\/p>\n<div class='wp_social_bookmarking_light'>        <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.vincentina.net\/?p=4829\" data-text=\"Docker+Chef\u3067\u74b0\u5883\u4f5c\u308a\u3000\uff11 PHP\/Nginx\" data-via=\"TakekenTw\" data-lang=\"ja\">Tweet<\/a><\/div><\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306eDocker + Chef \u3067\u697d\u3005\u74b0\u5883\u4f5c\u308a\u304b\u3089\u306e\u7d9a\u304d\u306b\u306a\u308a\u307e\u3059\u3002 \u7269\u4e8b\u306b\u306f\u9806\u5e8f\u3068\u3044\u3046\u3082\u306e\u304c\u5fc5\u8981\u306a\u306e\u3067\u3001Chef\u5b9f\u8df5\u5165\u9580\u3092\u53c2\u8003\u306b\u3057\u3064\u3064\u3001PHP\u74b0\u5883\uff5eApache\u3068\u9032\u3093\u3067\u304b\u3089Sinatra\u3092\u30fb\u30fb\u3068\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u66f8 &hellip; <a href=\"https:\/\/www.vincentina.net\/?p=4829\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Docker+Chef\u3067\u74b0\u5883\u4f5c\u308a\u3000\uff11 PHP\/Nginx&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106],"tags":[],"class_list":["post-4829","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts\/4829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4829"}],"version-history":[{"count":0,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts\/4829\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}