webサーバを H2O に変えてみた。

今までApacheを使用していたのですが、
DeNAで開発されている H2O と入れ替えてみました。

とりあえず使用するデータやwebサーバ以外の設定を極力維持する方向で入れ替え。
ログを確認してみたらちゃんとhttp2で通信してるみたいだ。

h2o の設定ファイルって結構独特ですね、
tabはng、インデントはスペース、redirect等のパラメータはインデントしていないとエラーになる。
追記:yamlって形式なんですね、知らなかったよ・・・

うちの設定、まぁ消す意味のあるところは無いのでそのまま載せている。
ポイントは http2-casper: ON 、これがないとキャッシュ機構の一部がうまく動かなかった。

W3 Total Cacheの Minify、jsとcssを無効にしないとキャッシュが読めなくてレイアウトが悲惨な事になる。
この辺りも後で調べておかないとなぁ。

2016/4/19追記:
jsとcssはそのままだとgzipが無効になってるので file.mime.settypes を追加。

user: apache

http2-casper: ON

file.custom-handler:
    extension: .php
    fastcgi.connect:
        host: 127.0.0.1
        port: /run/php-fpm/www.sock
        type: unix
file.mime.settypes:
    "application/javascript":
        extensions: [".js"]
        is_compressible: yes
    "text/css":
        extensions: [".css"]
        is_compressible: yes

file.index: [ 'index.php','index.html' ]

hosts:
  "op.cx:443":
    listen:
      port: 443
      host: 202.75.235.198
      ssl:
        certificate-file: "/etc/letsencrypt/live/op.cx/fullchain.pem"
        key-file: "/etc/letsencrypt/live/op.cx/privkey.pem"
    paths:
      "/":
        file.dir: /home/kdsoft/public_html/wp
        file.dirlisting: on
        redirect:
            url: /index.php/
            internal: YES
            status: 307
  "op.cx:80":
    listen:
      port: 80
      host: 202.75.235.198
    paths:
      "/":
        redirect:
            status: 301
            url: https://op.cx/
access-log: /var/log/h2o/access.log
error-log: /var/log/h2o/error.log
pid-file: /var/run/h2o/h2o.pid

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください