仮想ホストの設定例 事前に、OpenWrt/nginx を確認ください。
config server '_www_example_com' list listen '443 ssl' list listen '[::]:443 ssl' option server_name 'www.example.com' list include 'vhosts/www.example.com/restrict_locally' list include 'vhosts/www.example.com/conf.d/*.locations' option ssl_certificate '<証明書>' option ssl_certificate_key '<秘密鍵>' option ssl_session_cache 'shared:SSL:32k' option ssl_session_timeout '64m' option access_log 'on; # logd openwrt' # include のパスは適宜変更可能
proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; location / { # 192.168.1.100 のサーバーに転送 proxy_pass http://192.168.1.100/; }
config server '_test_example_com' list listen '80' list listen '[::]:80' list listen '443 ssl' list listen '[::]:443 ssl' option server_name 'test.example.com' list include 'vhosts/test.example.com/restrict_locally' list include 'vhosts/test.example.com/conf.d/*.locations' option ssl_certificate '<証明書>' option ssl_certificate_key '<秘密鍵>' option ssl_session_cache 'shared:SSL:32k' option ssl_session_timeout '64m' option access_log 'on; # logd openwrt' # include のパスは適宜変更可能
# security.conf で HSTS 設定が入っている場合、 # HTTP でのアクセスを許可するため、HSTS を無効にする。 more_clear_headers 'Strict-Transport-Security'; location / { # test.example.com へアクセスがあった場合、/www-test 配下の # コンテンツを表示する。 root /www-test; }