nixos/services/nginx_vHosts/forgejo.nix

34 lines
942 B
Nix
Raw Normal View History

2019-06-22 23:58:08 +02:00
{
2023-09-11 20:23:04 +02:00
config,
lib,
...
}:
with lib;
{
vHost =
2024-05-09 12:41:24 +02:00
if config.services.forgejo.enable
2023-09-11 20:23:04 +02:00
then {
2024-05-09 12:41:24 +02:00
root = "${config.services.forgejo.stateDir}/public";
2023-09-11 20:23:04 +02:00
extraConfig = ''
location / {
try_files maintain.html $uri $uri/index.html @node;
}
2019-06-22 23:58:08 +02:00
2023-09-11 20:23:04 +02:00
location @node {
client_max_body_size 0;
2024-05-09 12:41:24 +02:00
proxy_pass http://${config.services.forgejo.settings.server.HTTP_ADDR}:${toString config.services.forgejo.settings.server.HTTP_PORT};
2023-09-11 20:23:04 +02:00
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_max_temp_file_size 0;
proxy_redirect off;
proxy_read_timeout 120;
}
'';
2019-06-22 23:58:08 +02:00
}
2023-09-11 20:23:04 +02:00
else {};
}
.vHost