2024.02.16 debian bookworm
2023.03.04 debian bullseye
2020.04.09 raspbian buster
$audo apt-get install h2o |
/etc/h2o/h2o.conf
タブは使えないので注意。字下げをするところはきちんとしないとエラーになるので注意
server-name: "h2o
(Debian)" user: www-data access-log: "|rotatelogs -l -f -L /var/log/h2o/access.log -p /usr/share/h2o/compress_logs /var/log/h2o/access.log.%Y-%m-%d 86400" error-log: "|rotatelogs -l -f -L /var/log/h2o/error.log -p /usr/share/h2o/compress_logs /var/log/h2o/error.log.%Y-%m-%d 86400" pid-file: /run/h2o.pid hosts: "karappi.mydns.jp:80": listen: port: 80 paths: /: file.dir: /home/hogehoge/public_html redirect: url: /index.html/ internal: YES status: 307 /server-status: status: ON |
# /usr/bin/h2o -c
h2o.conf -t configuration OK |
$ sudo systemctl
restart h2o |
$ sudo
gpasswd -a karappi www-data |
$ sudo chmod 755
/home/karappi |
$ sudo apt-get install fcgiwrap |
server-name: "h2o
(Debian)" user: www-data access-log: "|rotatelogs -l -f -L /var/log/h2o/access.log -p /usr/share/h2o/compress_logs /var/log/h2o/access.log.%Y-%m-%d 86400" error-log: "|rotatelogs -l -f -L /var/log/h2o/error.log -p /usr/share/h2o/compress_logs /var/log/h2o/error.log.%Y-%m-%d 86400" pid-file: /run/h2o.pid hosts: "karappi.mydns.jp:80": listen: port: 80 paths: /: file.dir: /home/hogehoge/public_html redirect: url: /index.html/ internal: YES status: 307 file.custom-handler: extension: .cgi fastcgi.spawn: command: "exec /usr/sbin/fcgiwrap" /server-status: status: ON |
#!/usr/bin/env
python3.7 class htmlput(): def __init__(self): print('Content-type: text/html \n\n') '''上の最後の改行コード2個ってちょっとしたノウハウ''' def html_send(self,msg_str): txt=''' <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>pythonでwebページを表示</title> </head> <body link="#0000EE" vlink="#551A8B" text="#000000" bgcolor="#ffff99" alink="#EE0000"> {} <br> </body> </html> ''' print(txt.format(msg_str)) htm=htmlput() htm.html_send('python ためし<br>') |
#!/usr/bin/ruby -Ku STDOUT.sync = true puts "Content-type: text/html" puts # 上の行のContent-type: text/htmlのあとに1個putを入れておかないとなぜかエラーに #以下略 |
server-name: "h2o
(Debian)" user: www-data access-log: "|rotatelogs -l -f -L /var/log/h2o/access.log -p /usr/share/h2o/compress_logs /var/log/h2o/access.log.%Y-%m-%d 86400" error-log: "|rotatelogs -l -f -L /var/log/h2o/error.log -p /usr/share/h2o/compress_logs /var/log/h2o/error.log.%Y-%m-%d 86400" pid-file: /run/h2o.pid hosts: "karappi.mydns.jp:80": listen: port: 80 paths: /: file.dir: /home/hogehoge/public_html redirect: url: /index.html/ internal: YES status: 307 file.custom-handler: extension: .cgi fastcgi.spawn: command: "exec /usr/sbin/fcgiwrap" /kisho: mruby.handler: | require "htpasswd.rb" acl { use Htpasswd.new("/home/hogehoge/.htpasswd", "realm-name") } file.dir: /home/hogehoge/public_html/kisho file.custom-handler: extension: .cgi fastcgi.spawn: command: "exec /usr/sbin/fcgiwrap" /server-status: status: ON |
$ sudo apt-get install
mruby |
$ htpasswd -nbm ユーザid
パスワード > .htpasswd $ sudo chown www-data .htpasswd $ sudo chmod 400 .htpasswd |
# /usr/bin/h2o -c
/etc/h2o/h2o.conf -t configuration OK # systemctl restart h2o |