2020-03-06 08:28:19 +01:00
|
|
|
{ pkgs, lib, ... }:
|
2019-10-24 02:20:38 +02:00
|
|
|
let
|
2023-02-10 03:33:44 +01:00
|
|
|
access_log_sink = "<server>:<port>";
|
|
|
|
error_log_sink = "<server>:<port>";
|
2021-11-01 09:20:42 +01:00
|
|
|
in
|
|
|
|
{
|
2020-03-06 08:28:19 +01:00
|
|
|
|
2022-06-23 09:51:30 +02:00
|
|
|
security.acme.defaults.email = "contact@ingolf-wagner.de";
|
2020-05-19 20:44:20 +02:00
|
|
|
security.acme.acceptTerms = true;
|
|
|
|
|
2020-03-06 08:28:19 +01:00
|
|
|
services.nginx = {
|
2020-03-06 19:02:43 +01:00
|
|
|
|
2020-03-06 08:28:19 +01:00
|
|
|
# Use recommended settings
|
|
|
|
recommendedGzipSettings = lib.mkDefault true;
|
|
|
|
recommendedOptimisation = lib.mkDefault true;
|
|
|
|
recommendedProxySettings = lib.mkDefault true;
|
|
|
|
recommendedTlsSettings = lib.mkDefault true;
|
|
|
|
|
2023-02-10 03:33:44 +01:00
|
|
|
# for loki logging
|
2024-05-15 17:11:41 +02:00
|
|
|
#commonHttpConfig = ''
|
|
|
|
# log_format logfmt 'timestamp=$time_iso8601 '
|
|
|
|
# 'facility=nginx '
|
|
|
|
# 'src_addr=$remote_addr '
|
|
|
|
# 'body_bytes_sent=$body_bytes_sent '
|
|
|
|
# 'request_time=$request_time '
|
|
|
|
# 'response_status=$status '
|
|
|
|
# 'request="$request" '
|
|
|
|
# 'request_method="$request_method" '
|
|
|
|
# 'host="$host" '
|
|
|
|
# 'upstream_cache_status="$upstream_cache_status" '
|
|
|
|
# 'upstream_addr="$upstream_addr" '
|
|
|
|
# 'http_x_forwarded_for="$http_x_forwarded_for" '
|
|
|
|
# 'http_referrer="$http_referer" '
|
|
|
|
# 'http_user_agent="$http_user_agent"';
|
2024-05-15 22:54:12 +02:00
|
|
|
#
|
|
|
|
# # log to local journald
|
|
|
|
# access_log syslog:server=unix:/dev/log logfmt;
|
|
|
|
# '';
|
2023-02-10 03:33:44 +01:00
|
|
|
|
2020-03-15 15:53:00 +01:00
|
|
|
# for graylog logging
|
2022-09-20 21:48:36 +02:00
|
|
|
#commonHttpConfig = ''
|
|
|
|
# log_format graylog2_json escape=json '{ "timestamp": "$time_iso8601", '
|
|
|
|
# '"facility": "nginx", '
|
|
|
|
# '"src_addr": "$remote_addr", '
|
|
|
|
# '"body_bytes_sent": $body_bytes_sent, '
|
|
|
|
# '"request_time": $request_time, '
|
|
|
|
# '"response_status": $status, '
|
|
|
|
# '"request": "$request", '
|
|
|
|
# '"request_method": "$request_method", '
|
|
|
|
# '"host": "$host",'
|
|
|
|
# '"upstream_cache_status": "$upstream_cache_status",'
|
|
|
|
# '"upstream_addr": "$upstream_addr",'
|
|
|
|
# '"http_x_forwarded_for": "$http_x_forwarded_for",'
|
|
|
|
# '"http_referrer": "$http_referer", '
|
|
|
|
# '"http_user_agent": "$http_user_agent" }';
|
|
|
|
# access_log syslog:server=${access_log_sink} graylog2_json;
|
|
|
|
# error_log syslog:server=${error_log_sink};
|
|
|
|
#'';
|
2020-03-06 08:28:19 +01:00
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
services.nginx.package = pkgs.nginxMainline;
|
|
|
|
}
|