fix nginx

This commit is contained in:
2023-08-26 01:00:32 +08:00
parent f5a2ecdb39
commit bef540c0cc
5 changed files with 35 additions and 16 deletions

6
flake.lock generated
View File

@@ -627,11 +627,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1692980874,
"narHash": "sha256-KA6MGgPk5Zol96BTjVBV9bYPj/POotyHgoOKtctiJj4=",
"lastModified": 1692982424,
"narHash": "sha256-H0gz5N3k1rNu5EUxiZ6wcQ0Dxlaw1tbQGtMlXgPH30Q=",
"owner": "CHN-beta",
"repo": "nixpkgs",
"rev": "127bcf01ca05fdaf55b644f3b274dfaedd9a2aa6",
"rev": "ef4323e25b0991d997ae8f78e2a428b5cc98667c",
"type": "github"
},
"original": {

View File

@@ -979,7 +979,15 @@ inputs:
{
services =
{
nginx = { enable = true; httpProxy."wallabag.chn.moe".upstream = "http://127.0.0.1:4398"; };
nginx =
{
enable = true;
httpProxy."wallabag.chn.moe" =
{
upstream = "http://127.0.0.1:4398";
setHeaders.Host = "wallabag.chn.moe";
};
};
postgresql.enable = true;
};
virtualization.docker.enable = true;

View File

@@ -106,12 +106,17 @@ inputs:
enable = true;
httpProxy =
{
"${misskey.hostname}" = { upstream = "http://127.0.0.1:${toString misskey.port}"; websocket = true; };
"${misskey.hostname}" =
{
upstream = "http://127.0.0.1:${toString misskey.port}";
websocket = true;
setHeaders.Host = misskey.hostname;
};
"direct.${misskey.hostname}" =
{
upstream = "http://127.0.0.1:${toString misskey.port}";
websocket = true;
setHeaders.Host = "${misskey.hostname}";
setHeaders.Host = misskey.hostname;
detectAuth = true;
};
};

View File

@@ -67,6 +67,12 @@ inputs:
{
proxyPass = site.value.upstream;
proxyWebsockets = site.value.websocket;
recommendedProxySettings = false;
recommendedProxySettingsNoHost = true;
basicAuthFile =
if site.value.detectAuth then
inputs.config.sops.secrets."nginx/detectAuth/${site.name}".path
else null;
extraConfig = concatStringsSep "\n"
(
(map
@@ -78,15 +84,7 @@ inputs:
["include ${inputs.config.sops.templates."nginx/addAuth/${site.name}-template".path};"]
else [])
);
}
// (
if site.value.detectAuth then
{
recommendedProxySettings = false;
basicAuthFile = inputs.config.sops.secrets."nginx/detectAuth/${site.name}".path;
}
else {}
);
};
addSSL = true;
forceSSL = site.value.rewriteHttps;
http2 = site.value.http2;

View File

@@ -57,7 +57,15 @@ inputs:
nixos.services =
{
redis.instances.rsshub.port = 7116;
nginx = { enable = true; httpProxy.${rsshub.hostname}.upstream = "http://127.0.0.1:${toString rsshub.port}"; };
nginx =
{
enable = true;
httpProxy.${rsshub.hostname} =
{
upstream = "http://127.0.0.1:${toString rsshub.port}";
setHeaders.Host = rsshub.hostname;
};
};
};
};
}