2020-07-10 00:58:55 +02:00
|
|
|
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
|
2022-10-10 10:19:42 +02:00
|
|
|
{%- from "nginx/map.jinja" import nginx with context %}
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
{%- if nginx.config.geoip %}
|
|
|
|
load_module modules/ngx_http_geoip2_module.so;
|
|
|
|
{%- endif%}
|
2023-11-10 13:26:06 +01:00
|
|
|
{%- if nginx.config.webdav %}
|
|
|
|
load_module modules/ngx_http_dav_ext_module.so;
|
|
|
|
{%- endif%}
|
2024-04-11 10:30:13 +02:00
|
|
|
{%- if nginx.config.lua %}
|
2024-04-11 10:54:41 +02:00
|
|
|
load_module modules/ndk_http_module.so;
|
2024-04-11 10:30:13 +02:00
|
|
|
load_module modules/ngx_http_lua_module.so;
|
|
|
|
{%- endif%}
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
user {{ nginx.config.user }};
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
worker_processes {{ nginx.config.workers }};
|
|
|
|
|
|
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
error_log syslog:server=localhost:514 info;
|
2020-07-10 00:58:55 +02:00
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
2023-03-10 00:05:57 +01:00
|
|
|
include access;
|
2022-10-10 10:19:42 +02:00
|
|
|
include fastcgi_params;
|
|
|
|
include proxy_params;
|
|
|
|
include mime.types;
|
|
|
|
include ssl_params;
|
|
|
|
charset utf-8;
|
|
|
|
|
2023-12-04 22:34:43 +01:00
|
|
|
types_hash_bucket_size 256;
|
|
|
|
types_hash_max_size 2048;
|
|
|
|
|
2023-06-06 09:24:24 +02:00
|
|
|
real_ip_header proxy_protocol;
|
|
|
|
set_real_ip_from 127.0.0.1;
|
|
|
|
set_real_ip_from ::1;
|
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
{%- if nginx.config.geoip %}
|
|
|
|
geoip2 /usr/share/GeoIP/GeoLite2-ASN.mmdb {
|
|
|
|
$geoip2_asn default=0 autonomous_system_number;
|
|
|
|
$geoip2_org default=ISP autonomous_system_organization;
|
|
|
|
}
|
|
|
|
|
|
|
|
geoip2 /usr/share/GeoIP/GeoLite2-City.mmdb {
|
|
|
|
$geoip2_country_name default=England country names en;
|
|
|
|
$geoip2_city_name default=London city names en;
|
|
|
|
}
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
include sites-enabled/*;
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
log_format main '$http_x_forwarded_for - $remote_user [$time_iso8601] '
|
|
|
|
'"$request" $status $body_bytes_sent '
|
|
|
|
'"$http_referer" "$http_user_agent"';
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
access_log /var/log/nginx/$host.access.log main;
|
|
|
|
access_log syslog:server=localhost:514 main;
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
default_type application/octet-stream;
|
2023-03-10 00:05:57 +01:00
|
|
|
tcp_nodelay on;
|
2022-10-10 10:19:42 +02:00
|
|
|
sendfile on;
|
|
|
|
keepalive_timeout 60;
|
|
|
|
server_tokens off;
|
2022-02-21 13:52:46 +01:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
proxy_intercept_errors on;
|
|
|
|
fastcgi_intercept_errors on;
|
|
|
|
fastcgi_read_timeout 300;
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
gzip on;
|
|
|
|
gzip_vary on;
|
2023-03-10 00:05:57 +01:00
|
|
|
gzip_min_length 1023;
|
2022-10-10 10:19:42 +02:00
|
|
|
gzip_proxied expired no-cache no-store private auth;
|
|
|
|
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
|
2020-07-10 00:58:55 +02:00
|
|
|
|
|
|
|
server {
|
2024-01-03 13:29:16 +01:00
|
|
|
listen {{ nginx.config.http_port }} default_server;
|
|
|
|
listen [::]:{{ nginx.config.http_port }} default_server;
|
|
|
|
listen {{ nginx.config.http_proxy_port }} default_server proxy_protocol;
|
|
|
|
listen [::]:{{ nginx.config.http_proxy_port }} default_server proxy_protocol;
|
|
|
|
|
|
|
|
listen {{ nginx.config.https_port }} default_server ssl http2;
|
|
|
|
listen [::]:{{ nginx.config.https_port }} default_server ssl http2;
|
|
|
|
listen {{ nginx.config.https_proxy_port }} default_server ssl http2 proxy_protocol;
|
|
|
|
listen [::]:{{ nginx.config.https_proxy_port }} default_server ssl http2 proxy_protocol;
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2022-10-10 10:19:42 +02:00
|
|
|
root /var/www/html;
|
|
|
|
index index.html;
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2023-02-04 19:53:17 +01:00
|
|
|
location = / {
|
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
|
|
|
|
location = /status {
|
2022-10-10 10:19:42 +02:00
|
|
|
stub_status on;
|
|
|
|
access_log off;
|
|
|
|
allow 127.0.0.1;
|
|
|
|
allow ::1;
|
|
|
|
deny all;
|
2020-07-10 00:58:55 +02:00
|
|
|
}
|
|
|
|
}
|
2020-10-28 22:56:28 +01:00
|
|
|
}
|