以前RedashをSSL化したブログの中で…
「あとでH2Oにしてみよう」
Yeah!?
■/etc/h2o
| 1 2 3 4 5 6 7 | /etc/h2o# tree . ├── conf.d │   └── redash.adachin.com.conf ├── h2o.conf └── mruby     └── htpasswd.rb | 
・h2o.conf
| 1 2 3 4 5 6 7 | user: nobody pid-file: /var/run/h2o/h2o.pid hosts:   <<: !file /etc/h2o/conf.d/redash.adachin.com.conf error-log: /var/log/h2o/all-virtual.error.log | 
・redash.adachin.com.conf
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | "redash.adachin.com:80":   listen:     port: 80   paths:     "/":       redirect: https://redash.adachin.com       proxy.reverse.url: http://127.0.0.1:5000/ "redash.adachin.com:443":   listen:     port: 443     ssl:       certificate-file: /etc/letsencrypt/live/redash.adachin.com/fullchain.pem       key-file: /etc/letsencrypt/live/redash.adachin.com/privkey.pem   paths:     "/":       mruby.handler: |         require "htpasswd.rb"            acl {             allow { addr == "xxx.xxx.xxx.xxx" }             deny { user_agent.match(/curl/i)  && ! addr.start_with?("192.168.") }             use Htpasswd.new("/opt/redash/.htpasswd", "realm-name") { path.start_with?("/") }           }       proxy.reverse.url: http://127.0.0.1:5000/       proxy.preserve-host: ON   access-log: /var/log/h2o/redash.adachin.com.access.log | 
基本アプリ側であるRedashは5000 portで動いてるのでH2Oにproxyするだけ。
■確認
安定の速さ!
といってもデフォルトのNginxでも速い。
■まとめ
以前RedmineもH2O化した時のことを思い出してw
特にハマることもなく簡単にできました。
[H2O][Proxy Directives][redmine]プロキシにしたRailsアプリのhttpsがリダイレクト時にhttpになってしまう
参考
https://h2o.examp1e.net/configure/proxy_directives.html


 
													 
													
0件のコメント