infra/roles/nginx/templates/nginx.conf.j2

73 lines
2.2 KiB
Django/Jinja

# {{ansible_managed}}
user www-data;
pid /var/run/nginx.pid;
worker_processes auto;
error_log /var/log/nginx/default_error.log warn;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type "application/octet-stream";
# nginx hack
# if $authelia_user doesnt exist, set it to empty string
# if $authelia_user does exist, do nothing
# map $host $authelia_user {
# "" "";
# default $authelia_user;
# }
# map $host $authelia_groups {
# "" "";
# default $authelia_groups;
# }
map $host $authelia_user {
default "";
}
map $host $authelia_email {
default "";
}
map $host $authelia_groups {
default "";
}
log_format main '{"remote_addr": "$remote_addr", '
' "remote_user": "$authelia_user", '
' "authelia_user": "$authelia_user", '
' "remote_email": "$authelia_email", '
' "authelia_email": "$authelia_email", '
' "authelia_groups": "$authelia_groups", '
' "time_local": "$time_local", '
' "timestamp": "$time_iso8601", '
' "request": "$request", '
' "request_method": "$request_method", '
' "request_uri": "$request_uri", '
' "uri": "$uri", '
' "http_connection": "$http_connection", '
' "http_upgrade": "$http_upgrade", '
' "server_name": "$server_name", '
' "server_port": "$server_port", '
' "status": "$status", '
' "body_bytes_sent": $body_bytes_sent, '
' "http_referer": "$http_referer", '
' "http_host": "$http_host", '
' "http_user_agent": "$http_user_agent", '
' "http_x_forwarded_for": "$http_x_forwarded_for"}';
access_log /var/log/nginx/access_default.log main;
error_log /var/log/nginx/error_default.log;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server_tokens off;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}