services.nginx

Support both HTTP and HTTPS in a single virtualHost #25533 github

services.nginx = { enable = true; recommendedProxySettings = false; recommendedTlsSettings = true; virtualHosts = { "wiki.ralfbarkow.ch" = { enableACME = true; enableSSL = true; extraConfig = '' listen 80; ''; locations."/" = { proxyPass = "http://127.0.0.1:3000"; proxyWebsockets = true; }; };

[…] trace: warning: config.services.nginx.virtualHosts.<name>.enableSSL is deprecated, use config.services.nginx.virtualHosts.<name>.onlySSL instead.

Note: We need to check recommendedProxySettings.

# nginx-wiki.nix @dreyeck.ch

The new virtualHosts entry blog.dreyeck.ch only affects HTTP. HTTPS is covered by the *.dreyeck.ch entry.

services.nginx = { enable = true; recommendedProxySettings = true; recommendedTlsSettings = true; virtualHosts = { "blog.dreyeck.ch" = { locations."/" = { proxyPass = "http://127.0.0.1:4040"; proxyWebsockets = true; }; }; "rgb.dreyeck.ch" = { forceSSL = true; useACMEHost = "dreyeck.ch"; locations."/" = { proxyPass = "http://127.0.0.1:8080"; # see fossil.nix proxyWebsockets = true; }; }; "*.dreyeck.ch" = { useACMEHost = "dreyeck.ch"; enableSSL = true; extraConfig = '' listen 80; ''; locations."/" = { proxyPass = "http://127.0.0.1:3000"; proxyWebsockets = true; }; }; }; }