Skip to content

Commit f58f581

Browse files
authored
Merge pull request #292 from nix-community/fix-nginx
fix outputsPath nginx config
2 parents d6dbb30 + 262c6de commit f58f581

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

nix/master.nix

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -753,20 +753,30 @@ in
753753

754754
services.nginx.enable = true;
755755
services.nginx.virtualHosts.${cfg.domain} = {
756-
locations = {
757-
"/".proxyPass = "http://127.0.0.1:${builtins.toString backendPort}/";
758-
"/sse" = {
759-
proxyPass = "http://127.0.0.1:${builtins.toString backendPort}/sse";
760-
# proxy buffering will prevent sse to work
761-
extraConfig = "proxy_buffering off;";
762-
};
763-
"/ws" = {
764-
proxyPass = "http://127.0.0.1:${builtins.toString backendPort}/ws";
765-
proxyWebsockets = true;
766-
# raise the proxy timeout for the websocket
767-
extraConfig = "proxy_read_timeout 6000s;";
756+
locations =
757+
{
758+
"/".proxyPass = "http://127.0.0.1:${builtins.toString backendPort}/";
759+
"/sse" = {
760+
proxyPass = "http://127.0.0.1:${builtins.toString backendPort}/sse";
761+
# proxy buffering will prevent sse to work
762+
extraConfig = "proxy_buffering off;";
763+
};
764+
"/ws" = {
765+
proxyPass = "http://127.0.0.1:${builtins.toString backendPort}/ws";
766+
proxyWebsockets = true;
767+
# raise the proxy timeout for the websocket
768+
extraConfig = "proxy_read_timeout 6000s;";
769+
};
770+
}
771+
// lib.optionalAttrs (cfg.outputsPath != null) {
772+
"/nix-outputs/" = {
773+
alias = cfg.outputsPath;
774+
extraConfig = ''
775+
charset utf-8;
776+
autoindex on;
777+
'';
778+
};
768779
};
769-
} // lib.optionalAttrs (cfg.outputsPath != null) { "/nix-outputs/".alias = cfg.outputsPath; };
770780
};
771781

772782
systemd.tmpfiles.rules =

0 commit comments

Comments
 (0)