diff options
author | Izorkin <izorkin@elven.pw> | 2023-12-23 12:48:04 +0300 |
---|---|---|
committer | Izorkin <izorkin@elven.pw> | 2023-12-30 23:49:58 +0300 |
commit | 7f1b6d45afb5b2ca33d06507198fbb5c2bdbe9ee (patch) | |
tree | 6d320dcd5ceb90e6f4e02e66d12fd254e6131bda | |
parent | d3252cdceaf087f377ff5f61c43a666847027a0e (diff) | |
download | nixlib-7f1b6d45afb5b2ca33d06507198fbb5c2bdbe9ee.tar nixlib-7f1b6d45afb5b2ca33d06507198fbb5c2bdbe9ee.tar.gz nixlib-7f1b6d45afb5b2ca33d06507198fbb5c2bdbe9ee.tar.bz2 nixlib-7f1b6d45afb5b2ca33d06507198fbb5c2bdbe9ee.tar.lz nixlib-7f1b6d45afb5b2ca33d06507198fbb5c2bdbe9ee.tar.xz nixlib-7f1b6d45afb5b2ca33d06507198fbb5c2bdbe9ee.tar.zst nixlib-7f1b6d45afb5b2ca33d06507198fbb5c2bdbe9ee.zip |
nixos/nginx: change position acmeLocation in nginx configuration
-rw-r--r-- | nixos/modules/services/web-servers/nginx/default.nix | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix index 6c08d0aee3d7..0ec8d95ad3aa 100644 --- a/nixos/modules/services/web-servers/nginx/default.nix +++ b/nixos/modules/services/web-servers/nginx/default.nix @@ -375,10 +375,11 @@ let ${concatMapStringsSep "\n" listenString redirectListen} server_name ${vhost.serverName} ${concatStringsSep " " vhost.serverAliases}; - ${acmeLocation} + location / { return ${toString vhost.redirectCode} https://$host$request_uri; } + ${acmeLocation} } ''} @@ -392,13 +393,6 @@ let http3 ${if vhost.http3 then "on" else "off"}; http3_hq ${if vhost.http3_hq then "on" else "off"}; ''} - ${acmeLocation} - ${optionalString (vhost.root != null) "root ${vhost.root};"} - ${optionalString (vhost.globalRedirect != null) '' - location / { - return ${toString vhost.redirectCode} http${optionalString hasSSL "s"}://${vhost.globalRedirect}$request_uri; - } - ''} ${optionalString hasSSL '' ssl_certificate ${vhost.sslCertificate}; ssl_certificate_key ${vhost.sslCertificateKey}; @@ -421,6 +415,14 @@ let ${mkBasicAuth vhostName vhost} + ${optionalString (vhost.root != null) "root ${vhost.root};"} + + ${optionalString (vhost.globalRedirect != null) '' + location / { + return ${toString vhost.redirectCode} http${optionalString hasSSL "s"}://${vhost.globalRedirect}$request_uri; + } + ''} + ${acmeLocation} ${mkLocations vhost.locations} ${vhost.extraConfig} |