send nginx log to journal
Some checks failed
Test Nix flake / Test nix flake (push) Has been cancelled
Some checks failed
Test Nix flake / Test nix flake (push) Has been cancelled
This commit is contained in:
parent
14fe8e912e
commit
6022b14de8
7 changed files with 46 additions and 26 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
fqdn = "dav.${config.networking.domain}";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../services/nginx.nix
|
../../services/nginx.nix
|
||||||
|
|
@ -9,15 +12,20 @@
|
||||||
services = {
|
services = {
|
||||||
baikal = {
|
baikal = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHost = "dav.${config.networking.domain}";
|
virtualHost = fqdn;
|
||||||
};
|
};
|
||||||
|
|
||||||
nginx.virtualHosts."dav.${config.networking.domain}" = {
|
nginx.virtualHosts.${fqdn} = {
|
||||||
default = true;
|
default = true;
|
||||||
quic = true;
|
quic = true;
|
||||||
kTLS = true;
|
kTLS = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
||||||
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] fqdn} warn;
|
||||||
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,9 @@ in
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
merge_slashes off; # Required to handle URL-encoded slashes
|
merge_slashes off; # Required to handle URL-encoded slashes
|
||||||
|
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
||||||
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] fqdn} warn;
|
||||||
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
'';
|
'';
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
|
|
@ -93,7 +96,6 @@ in
|
||||||
proxyPass = "http://unix:${config.services.forgejo.settings.server.HTTP_ADDR}";
|
proxyPass = "http://unix:${config.services.forgejo.settings.server.HTTP_ADDR}";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
client_max_body_size 512M;
|
client_max_body_size 512M;
|
||||||
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"/metrics" = {
|
"/metrics" = {
|
||||||
|
|
@ -109,7 +111,6 @@ in
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
proxyPass = "http://unix:${config.services.forgejo.settings.server.HTTP_ADDR}";
|
proxyPass = "http://unix:${config.services.forgejo.settings.server.HTTP_ADDR}";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
|
||||||
limit_req zone=forgejo_archive burst=10 nodelay;
|
limit_req zone=forgejo_archive burst=10 nodelay;
|
||||||
limit_conn forgejo_archive_conn 2;
|
limit_conn forgejo_archive_conn 2;
|
||||||
limit_req_status 429;
|
limit_req_status 429;
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,11 @@
|
||||||
kTLS = true;
|
kTLS = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
||||||
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] fqdn} warn;
|
||||||
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
|
'';
|
||||||
locations = {
|
locations = {
|
||||||
"/".return = "418 \"🫖\"";
|
"/".return = "418 \"🫖\"";
|
||||||
"~ ^(/_matrix|/_synapse/client)" = {
|
"~ ^(/_matrix|/_synapse/client)" = {
|
||||||
|
|
@ -82,7 +87,6 @@
|
||||||
client_max_body_size 64M;
|
client_max_body_size 64M;
|
||||||
proxy_set_header X-Request-ID $request_id;
|
proxy_set_header X-Request-ID $request_id;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"/_synapse/metrics" = {
|
"/_synapse/metrics" = {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.hedgedoc.settings;
|
cfg = config.services.hedgedoc.settings;
|
||||||
|
fqdn = "md.${config.networking.domain}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
|
@ -14,7 +15,7 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
environmentFile = config.age.secrets.hedgedoc_db_password.path;
|
environmentFile = config.age.secrets.hedgedoc_db_password.path;
|
||||||
settings = {
|
settings = {
|
||||||
domain = "md.${config.networking.domain}";
|
domain = fqdn;
|
||||||
dbURL = "postgres://hedgedoc:\${DB_PASSWORD}@sql.berlin.ccc.de:5432/hedgedoc";
|
dbURL = "postgres://hedgedoc:\${DB_PASSWORD}@sql.berlin.ccc.de:5432/hedgedoc";
|
||||||
db.dialect = "postgresql";
|
db.dialect = "postgresql";
|
||||||
protocolUseSSL = true;
|
protocolUseSSL = true;
|
||||||
|
|
@ -24,28 +25,29 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nginx.virtualHosts."md.${config.networking.domain}" = {
|
nginx.virtualHosts.${fqdn} = {
|
||||||
default = true;
|
default = true;
|
||||||
quic = true;
|
quic = true;
|
||||||
kTLS = true;
|
kTLS = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
||||||
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] fqdn} warn;
|
||||||
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
|
'';
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
add_header Content-Security-Policy "frame-src 'self'; default-src 'self'; script-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'; form-action 'self'; upgrade-insecure-requests;" always;
|
add_header Content-Security-Policy "frame-src 'self'; default-src 'self'; script-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'; form-action 'self'; upgrade-insecure-requests;" always;
|
||||||
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"/socket.io/" = {
|
"/socket.io/" = {
|
||||||
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
extraConfig = ''
|
|
||||||
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
"/metrics" = {
|
"/metrics" = {
|
||||||
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
||||||
|
|
|
||||||
|
|
@ -66,34 +66,27 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nginx.virtualHosts."monitoring.${config.networking.domain}" = {
|
nginx.virtualHosts.${fqdn} = {
|
||||||
default = true;
|
default = true;
|
||||||
quic = true;
|
quic = true;
|
||||||
kTLS = true;
|
kTLS = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
#extraConfig = ''
|
extraConfig = ''
|
||||||
# map $http_upgrade $connection_upgrade {
|
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
||||||
# default upgrade;
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] fqdn} warn;
|
||||||
# \'\' close;
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
# }
|
'';
|
||||||
#'';
|
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
basicAuthFile = config.age.secrets.grafana_basic_auth.path;
|
basicAuthFile = config.age.secrets.grafana_basic_auth.path;
|
||||||
proxyPass = "http://unix:/run/grafana/grafana.sock";
|
proxyPass = "http://unix:/run/grafana/grafana.sock";
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
extraConfig = ''
|
|
||||||
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
"/api/live/" = {
|
"/api/live/" = {
|
||||||
proxyPass = "http://unix:/run/grafana/grafana.sock";
|
proxyPass = "http://unix:/run/grafana/grafana.sock";
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
extraConfig = ''
|
|
||||||
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ in
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
add_header Strict-Transport-Security max-age=15768000;
|
add_header Strict-Transport-Security max-age=15768000;
|
||||||
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] "mta-sts.${config.networking.domain}"} warn;
|
||||||
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
'';
|
'';
|
||||||
locations."= /.well-known/mta-sts.txt" = {
|
locations."= /.well-known/mta-sts.txt" = {
|
||||||
alias = "/srv/http/mta-sts.txt";
|
alias = "/srv/http/mta-sts.txt";
|
||||||
|
|
@ -41,6 +43,8 @@ in
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
|
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
|
||||||
add_header Strict-Transport-Security max-age=15768000;
|
add_header Strict-Transport-Security max-age=15768000;
|
||||||
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] "www.${config.networking.domain}"} warn;
|
||||||
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
'';
|
'';
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
|
|
@ -104,6 +108,10 @@ in
|
||||||
kTLS = true;
|
kTLS = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
|
extraConfig = ''
|
||||||
|
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] "staging.${config.networking.domain}"} warn;
|
||||||
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||||
|
'';
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
basicAuthFile = config.age.secrets.www-staging-htpasswd.path;
|
basicAuthFile = config.age.secrets.www-staging-htpasswd.path;
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,13 @@
|
||||||
recommendedGzipSettings = true;
|
recommendedGzipSettings = true;
|
||||||
recommendedBrotliSettings = true;
|
recommendedBrotliSettings = true;
|
||||||
commonHttpConfig = ''
|
commonHttpConfig = ''
|
||||||
|
log_format vhost_combined '$host:$server_port $remote_addr - $remote_user [$time_local] '
|
||||||
|
'"$request" $status $body_bytes_sent '
|
||||||
|
'"$http_referer" "$http_user_agent"';
|
||||||
|
|
||||||
map $remote_addr $proxy_forwarded_for_element {
|
map $remote_addr $proxy_forwarded_for_element {
|
||||||
# IPv4 addresses can be sent as-is
|
# IPv4 addresses can be sent as-is
|
||||||
~^[0-9.]+$ "for=$remote_addr:$remote_port";
|
~^[0-9.]+$ "for=\"$remote_addr:$remote_port\"";
|
||||||
|
|
||||||
# IPv6 addresses need to be bracketed and quoted
|
# IPv6 addresses need to be bracketed and quoted
|
||||||
~^[0-9A-Fa-f:.]+$ "for=\"[$remote_addr]:$remote_port\"";
|
~^[0-9A-Fa-f:.]+$ "for=\"[$remote_addr]:$remote_port\"";
|
||||||
|
|
@ -30,7 +34,7 @@
|
||||||
|
|
||||||
map $server_addr $proxy_forwarded_by_element {
|
map $server_addr $proxy_forwarded_by_element {
|
||||||
# IPv4 addresses can be sent as-is
|
# IPv4 addresses can be sent as-is
|
||||||
~^[0-9.]+$ "by=$server_addr:$server_port";
|
~^[0-9.]+$ "by=\"$server_addr:$server_port\"";
|
||||||
|
|
||||||
# IPv6 addresses need to be bracketed and quoted
|
# IPv6 addresses need to be bracketed and quoted
|
||||||
~^[0-9A-Fa-f:.]+$ "by=\"[$server_addr]:$server_port\"";
|
~^[0-9A-Fa-f:.]+$ "by=\"[$server_addr]:$server_port\"";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue