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%}
|
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;
|
|
|
|
|
|
|
|
{%- 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 {
|
2023-03-10 00:05:57 +01:00
|
|
|
listen {{ nginx.config.http_port }} default_server proxy_protocol;
|
|
|
|
listen [::]:{{ nginx.config.http_port }} default_server proxy_protocol;
|
2020-07-10 00:58:55 +02:00
|
|
|
|
2023-03-10 00:05:57 +01:00
|
|
|
listen {{ nginx.config.https_port }} default_server ssl http2 proxy_protocol;
|
|
|
|
listen [::]:{{ nginx.config.https_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-01-04 23:33:04 +01:00
|
|
|
real_ip_header X-Forwarded-For;
|
|
|
|
set_real_ip_from 127.0.0.1;
|
|
|
|
set_real_ip_from ::1;
|
|
|
|
|
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
|
|
|
}
|