{"id":2254,"date":"2015-09-22T18:07:03","date_gmt":"2015-09-22T09:07:03","guid":{"rendered":"http:\/\/tech.akat.info\/?p=2254"},"modified":"2015-09-26T19:56:44","modified_gmt":"2015-09-26T10:56:44","slug":"h2o-on-ubuntu","status":"publish","type":"post","link":"https:\/\/tech.akat.info\/?p=2254","title":{"rendered":"H2O on ubuntu"},"content":{"rendered":"<p>HTTP\/2 \u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u304c\u3068\u3066\u3082\u3068\u3066\u3082\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f<br \/>\n<a href=\"http:\/\/yapcasia.org\/2015\/talk\/show\/dead6890-09b7-11e5-998a-67dc7d574c3a\">HTTP\/2\u6642\u4ee3\u306e\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u8a2d\u8a08<\/a><\/p>\n<h1>WEB\u524d\u63d0<\/h1>\n<p>\u30fb\u30e6\u30fc\u30b6\u306e\u30d0\u30f3\u30c9\u5e45\u304c\u5909\u308f\u3063\u3066\u3082\u30da\u30fc\u30b8\u30ed\u30fc\u30c9\u6642\u9593\u306f\u65e9\u304f\u306a\u3089\u306a\u3044(1.6Mbps\u3067\u6253\u3061\u6b62\u3081)<br \/>\n\u2192\u30ec\u30a4\u30c6\u30f3\u30b7\u304c\u5c0f\u3055\u3044\u307b\u3069\u30da\u30fc\u30b8\u30ed\u30fc\u30c9\u6642\u9593\u304c\u65e9\u304f\u306a\u308b<\/p>\n<h2>\u30ec\u30a4\u30c6\u30f3\u30b7\u3092\u5c0f\u3055\u304f\u3059\u308b\u305f\u3081\u306b\u306f<\/h2>\n<p>\u591a\u91cd\u901a\u4fe1 or \u30ec\u30a4\u30c6\u30f3\u30b7\u81ea\u4f53\u304c\u306a\u304f\u306a\u308b \u3053\u3068\u304c\u5fc5\u8981<\/p>\n<p>\u30fbHTTP\/1.1\u306f\u591a\u91cd\u6027\u304c\u306a\u3044<br \/>\n\u3000\u53b3\u5bc6\u306b\u8a00\u3048\u3070\u3001\u4ed5\u69d8\u306f\u3042\u308b\u304c\u73fe\u5b9f\u7684\u3067\u306f\u306a\u3044<\/p>\n<p>\u30fb\u3053\u308c\u4ee5\u4e0a\u306e\u30ec\u30a4\u30c6\u30f3\u30b7\u6e1b\u5c11\u306f\u5149\u30d5\u30a1\u30a4\u30d0\u306e\u5236\u7d04\u4e0a\u96e3\u3057\u3044<\/p>\n<h1>HTTP\/2\u3068\u306f<\/h1>\n<p>\u4e0a\u8a18\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306e\u30d7\u30ed\u30c8\u30b3\u30eb<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_115520.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_115520-300x274.png\" alt=\"2015-09-22_115520\" width=\"300\" height=\"274\" class=\"alignnone size-medium wp-image-2257\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_115520-300x274.png 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_115520.png 455w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n\u30d0\u30a4\u30ca\u30ea\u30d7\u30ed\u30c8\u30b3\u30eb\u3060\u304ch2i\u30b3\u30de\u30f3\u30c9\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3084\u308a\u53d6\u308a\u3092\u78ba\u8a8d\u3067\u304d\u308b<\/p>\n<p>\u5c0f\u3055\u306a\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u5927\u91cf\u6642\u306b\u30e1\u30ea\u30c3\u30c8\u3042\u308a<br \/>\n\u4ee5\u4e0bURL\u3088\u308a\u8907\u6570\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u5834\u5408\u3001\u9ad8\u901f\u5316\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308b<br \/>\n<a href=\"https:\/\/www.symfony.fi\/entry\/compare-resource-loading-between-http-2-and-http-1-1\">Compare resource loading between HTTP\/2 (H2O) and HTTP\/1.1 (Nginx)<\/a><\/p>\n<p>HTTP\/2\u3067\u306f\u30ec\u30a4\u30c6\u30f3\u30b7\u306f\u6700\u5c0f\u9650\u306b\u6291\u3048\u3089\u308c\u3001\u7d50\u679c\u7684\u306b\u30d0\u30f3\u30c9\u5e45\u304c\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u306b\u306a\u308b\u305f\u3081<br \/>\n\u9ad8\u901f\u5316\u3059\u308b\u305f\u3081\u306b\u306f\u8ee2\u9001\u30c7\u30fc\u30bf\u91cf\u3092\u6e1b\u3089\u3059\u3079\u3057<\/p>\n<h1>h2o\u3068\u306f<\/h1>\n<p>\u30fb2014\u5e74\u590f\u3088\u308a\u958b\u767a\u3055\u308c\u3066\u3044\u308b\u3001\u5148\u9032\u7684\u306a HTTP\/2 \u30b5\u30fc\u30d0(\u30c7\u30a3\u30fc\u30fb\u30a8\u30cc\u30fb\u30a8\u30fc\u767a)<br \/>\n\u30fb\u73fe\u6bb5\u968e\u306e\u30bd\u30d5\u30c8\u3060\u3068\u4e00\u756a\u512a\u79c0\u3002\u6b21\u70b9nghttp2<br \/>\n\u3000(\u4ed6\u306e\u30bd\u30d5\u30c8\u3060\u3068\u512a\u5148\u5ea6\u5236\u5fa1\u3067\u3046\u307e\u304f\u51e6\u7406\u3067\u304d\u306a\u3044\u53ef\u80fd\u6027\u304c)<\/p>\n<h1>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@ubuntu14:\/usr\/local\/src# cat \/etc\/lsb-release\r\nDISTRIB_ID=Ubuntu\r\nDISTRIB_RELEASE=14.04\r\nDISTRIB_CODENAME=trusty\r\nDISTRIB_DESCRIPTION=&quot;Ubuntu 14.04.3 LTS&quot;\r\n\r\nroot@ubuntu14:\/usr\/local\/src# aptitude install git build-essential cmake libssl-dev libyaml-dev\r\n...\r\n\r\nroot@ubuntu14:\/usr\/local\/src# git clone git:\/\/github.com\/h2o\/h2o.git\r\nCloning into 'h2o'...\r\n...\r\n\r\nroot@ubuntu14:\/usr\/local\/src# cd h2o\/\r\nroot@ubuntu14:\/usr\/local\/src\/h2o# cmake .\r\n...\r\nroot@ubuntu14:\/usr\/local\/src\/h2o# make\r\n...\r\nroot@ubuntu14:\/usr\/local\/src# h2o\/h2o --help\r\nh2o version 1.5.0-beta3\r\n\r\nUsage:\r\n  h2o &#x5B;options]\r\n\r\nOptions:\r\n  -c, --conf FILE    configuration file (default: h2o.conf)\r\n  -m, --mode &lt;mode&gt;  specifies one of the following mode\r\n                     - worker: invoked process handles incoming connections\r\n                               (default)\r\n                     - daemon: spawns a master process and exits. `error-log`\r\n                               must be configured when using this mode, as all\r\n                               the errors are logged to the file instead of\r\n                               being emitted to STDERR\r\n                     - master: invoked process becomes a master process (using\r\n                               the `share\/h2o\/start_server` command) and spawns\r\n                               a worker process for handling incoming\r\n                               connections. Users may send SIGHUP to the master\r\n                               process to reconfigure or upgrade the server.\r\n                     - test:   tests the configuration and exits\r\n  -t, --test         synonym of `--mode=test`\r\n  -v, --version      prints the version number\r\n  -h, --help         print this help\r\n\r\nPlease refer to the documentation under `share\/doc\/h2o` (or available online at\r\nhttp:\/\/h2o.examp1e.net\/) for how to configure the server.\r\n<\/pre>\n<h1>\u8a2d\u5b9a<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@ubuntu14:\/usr\/local\/src# mkdir \/etc\/h2o\r\nroot@ubuntu14:\/usr\/local\/src# cp h2o\/examples\/h2o\/h2o.conf \/etc\/h2o\/\r\nroot@ubuntu14:\/usr\/local\/src# vi \/etc\/h2o\/h2o.conf\r\n# to find out the configuration commands, run: h2o --help\r\n\r\nlisten: 80\r\nhosts:\r\n   defaultt:\r\n    paths:\r\n      \/:\r\n        file.dir: \/var\/www\r\n    access-log: \/var\/www\/access.log\r\n\r\n### config\u30c1\u30a7\u30c3\u30af ###\r\nroot@ubuntu14:\/usr\/local\/src# h2o -c \/etc\/h2o\/h2o.conf -t\r\nconfiguration OK\r\nroot@ubuntu14:\/usr\/local\/src# cp -Rp h2o\/share\/h2o \/usr\/local\/share\/ # daemon\u3068\u3057\u3066\u8d77\u52d5\u306e\u305f\u3081\u306b\u5fc5\u8981\r\nroot@ubuntu14:\/usr\/local\/src# cp h2o\/h2o \/usr\/sbin\/\r\nroot@ubuntu14:\/usr\/local\/src# vi \/var\/www\/index.html\r\n&lt;h1&gt;Welcom to h2o&lt;\/h1&gt;\r\n\r\nroot@ubuntu14:\/usr\/local\/src# h2o -m daemon -c \/etc\/h2o\/h2o.conf\r\nstart_server (pid:3110) starting now...\r\n\r\nroot@ubuntu14:\/usr\/local\/src# ps afx | grep h2o\r\n 3144 pts\/2    S+     0:00                          \\_ grep --color=auto h2o\r\n 3112 ?        S      0:00 perl -x \/usr\/local\/share\/h2o\/start_server --log-file=\/var\/www\/error.log --daemonize --port=0.0.0.0:80 -- h2o -c \/etc\/h2o\/h2o.conf\r\n 3113 ?        Sl     0:00  \\_ h2o -c \/etc\/h2o\/h2o.conf\r\n 3114 ?        S      0:00      \\_ perl -x \/usr\/local\/share\/h2o\/annotate-backtrace-symbols\r\n<\/pre>\n<p>\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_171713.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_171713-300x70.png\" alt=\"2015-09-22_171713\" width=\"300\" height=\"70\" class=\"alignnone size-medium wp-image-2256\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_171713-300x70.png 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_171713-660x155.png 660w, https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_171713.png 807w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u306f<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;clientIPaddress] - - &#x5B;22\/Sep\/2015:17:16:10 +0900] &quot;GET \/index.html HTTP\/1.1&quot; 200 23 &quot;-&quot; &quot;Mozilla\/5.0 (Windows NT 6.1; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/45.0.2454.93 Safari\/537.36&quot;\r\n&#x5B;clientIPaddress] - - &#x5B;22\/Sep\/2015:17:16:11 +0900] &quot;GET \/favicon.ico HTTP\/1.1&quot; 404 9 &quot;http:\/\/104.199.129.118\/index.html&quot; &quot;Mozilla\/5.0 (Windows NT 6.1; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/45.0.2454.93 Safari\/537.36&quot;\r\n\r\n<\/pre>\n<h1>\u9ad8\u901f\u5316\u306e\u305f\u3081\u306e\u8a2d\u5b9a<\/h1>\n<p>\u5225\u30b5\u30fc\u30d0\u304b\u3089ab\u30b3\u30de\u30f3\u30c9\u3092\u5229\u7528\u3059\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nab -n 10000 -c 1000 http:\/\/104.199.129.118\/index.html\r\n<\/pre>\n<h2>\u521d\u671f<\/h2>\n<p><strong>Requests per second:    913.69 [#\/sec]<\/strong><\/p>\n<h2>\u8a2d\u5b9a\u5909\u66f4<\/h2>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# to find out the configuration commands, run: h2o --help\r\n\r\nlisten: 80\r\nerror-log: \/var\/www\/error.log\r\n# \u81ea\u52d5\u3067CPU\u6570\u3092\u307f\u3066\u30b9\u30ec\u30c3\u30c9\u6570\u3092\u8a2d\u5b9a\u3059\u308b\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u624b\u52d5\u3067\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\r\nnum-threads: 2\r\nmax-connections: 10240\r\nnum-name-resolution-threads: 1\r\n\r\nhosts:\r\n   defaultt:\r\n    paths:\r\n      \/:\r\n        file.dir: \/var\/www\r\n    access-log: \/var\/www\/access.log\r\n\r\n<\/pre>\n<p><strong>Requests per second:    1572.15 [#\/sec]<\/strong><br \/>\n\u300c\u3067\u304d\u308b\u3060\u3051\u30c7\u30d5\u30a9\u30eb\u30c8\u3092\u6700\u9069\u306a\u5f62\u3067\u63d0\u4f9b\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u300d\u3089\u3057\u304f\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u30dd\u30a4\u30f3\u30c8\u306f\u5c11\u306a\u3044\u3068\u306e\u3053\u3068<\/p>\n<h1>with PHP<\/h1>\n<pre class=\"brush: plain; title: h2o.conf; notranslate\" title=\"h2o.conf\">\r\n# to find out the configuration commands, run: h2o --help\r\n\r\nlisten: 80\r\nerror-log: \/var\/www\/error.log\r\n# \u81ea\u52d5\u3067CPU\u6570\u3092\u307f\u3066\u30b9\u30ec\u30c3\u30c9\u6570\u3092\u8a2d\u5b9a\u3059\u308b\u304c\u624b\u52d5\u3067\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\r\nnum-threads: 2\r\nmax-connections: 10240\r\nnum-name-resolution-threads: 1\r\n\r\nhosts:\r\n   defaultt:\r\n    paths:\r\n      \/:\r\n        file.dir: \/var\/www\r\n    access-log: \/var\/www\/access.log\r\n\r\nfile.custom-handler:\r\n  extension: .php\r\n  fastcgi.connect:\r\n    host: 127.0.0.1\r\n    port: 9000\r\n    type: tcp\r\n<\/pre>\n<p>\u203bphp-fpm\u30929000\u30dd\u30fc\u30c8\u3067\u8d77\u52d5\u6e08\u307f\u3068\u3059\u308b<\/p>\n<p>\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068PHP\u304c\u5b9f\u884c\u3055\u308c\u305f<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_200305.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_200305-300x99.png\" alt=\"2015-09-22_200305\" width=\"300\" height=\"99\" class=\"alignnone size-medium wp-image-2267\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_200305-300x99.png 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_200305-660x218.png 660w, https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/09\/2015-09-22_200305.png 1004w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h1>Unix Socket\u3082\u5229\u7528\u53ef\u80fd<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nfile.custom-handler:\r\n  extension: .php\r\n  fastcgi.connect:\r\n    host: 127.0.0.1\r\n    port: \/tmp\/fcgi.sock\r\n    type: unix\r\n<\/pre>\n<p>\u203bfastcgi.spawn\u3092\u5229\u7528\u3059\u308b\u3068H2O\u304cphp\u3092\u8d77\u52d5\u3001\u7ba1\u7406\u3059\u308b<\/p>\n<h1>\u53c2\u8003URL<\/h1>\n<p><a href=\"http:\/\/yapcasia.org\/2015\/talk\/show\/dead6890-09b7-11e5-998a-67dc7d574c3a\">HTTP\/2\u6642\u4ee3\u306e\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u8a2d\u8a08<\/a><br \/>\n<a href=\"http:\/\/www.slideshare.net\/kazuho\/http2-51888328\">HTTP\/2\u6642\u4ee3\u306e\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u8a2d\u8a08<\/a><br \/>\n<a href=\"http:\/\/blog.sasaplus1.com\/2014\/11\/04\/01\/\">H2O HTTP server\u3092\u3061\u3087\u3063\u3068\u3060\u3051\u4f7f\u3063\u3066\u307f\u305f<\/a><br \/>\n<a href=\"http:\/\/qiita.com\/cubicdaiya\/items\/235777dc401ec419b14e\">nginx\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u3068h2o<\/a><br \/>\n<a href=\"https:\/\/h2o.examp1e.net\/\">H2O<\/a><br \/>\n<a href=\"http:\/\/uzulla.hateblo.jp\/entry\/2015\/06\/22\/014853\">\u65b0\u3001PHP\u3068H2O\u3092fastCGI\u3067\u3064\u306a\u3050\u8a71\u3001\u89e3\u6c7a\u7de8<\/a><br \/>\n<a href=\"http:\/\/www.slideshare.net\/junichiishida\/h2o-and-php\">H2O\u3068PHP\u306e\u8a71<\/a><br \/>\n<a href=\"http:\/\/takeshiyako.blogspot.jp\/2014\/11\/http-wrk.html\">HTTP \u30d9\u30f3\u30c1\u30de\u30fc\u30af\u30c4\u30fc\u30eb wrk \u306e\u4f7f\u3044\u65b9<\/a>..\u5229\u7528\u3057\u3066\u3044\u306a\u3044\u304c\u30e1\u30e2..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HTTP\/2 \u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u304c\u3068\u3066\u3082\u3068\u3066\u3082\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f HTTP\/2\u6642\u4ee3\u306e\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u8a2d\u8a08 WEB\u524d\u63d0 \u30fb\u30e6\u30fc\u30b6\u306e\u30d0\u30f3\u30c9\u5e45\u304c\u5909\u308f\u3063\u3066\u3082\u30da\u30fc\u30b8\u30ed\u30fc\u30c9\u6642\u9593\u306f\u65e9\u304f\u306a\u3089\u306a\u3044(1.6Mbps\u3067\u6253\u3061\u6b62\u3081) \u2192\u30ec\u30a4\u30c6\u30f3\u30b7\u304c\u5c0f\u3055\u3044\u307b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[87],"tags":[],"_links":{"self":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/2254"}],"collection":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2254"}],"version-history":[{"count":13,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/2254\/revisions"}],"predecessor-version":[{"id":2274,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/2254\/revisions\/2274"}],"wp:attachment":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}