xoxys.nginx/templates/etc/nginx/nginx.conf.j2

86 lines
2.4 KiB
Plaintext
Raw Normal View History

#jinja2: lstrip_blocks: True
2019-07-18 08:59:41 +02:00
{{ ansible_managed | comment }}
2017-12-24 14:05:27 +01:00
user {{ nginx_user }} {{ nginx_group }};
2017-12-24 17:36:43 +01:00
worker_processes {{ nginx_worker_processes }};
2017-07-15 17:24:48 +02:00
2018-12-01 23:23:43 +01:00
pid /var/run/nginx.pid;
2017-07-15 17:24:48 +02:00
events {
2018-08-09 21:20:06 +02:00
worker_connections {{ nginx_worker_connections }};
2017-07-15 17:24:48 +02:00
}
http {
2018-08-09 21:20:06 +02:00
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
{% if nginx_error_log.enabled %}
2018-08-11 14:59:43 +02:00
error_log {{ nginx_error_log.file }} {{ nginx_error_log.level }};
{% else %}
error_log off;
{% endif %}
{% if nginx_access_log.enabled %}
2018-08-11 15:27:27 +02:00
access_log {{ nginx_access_log.file }} {{ nginx_access_log.format }};
2018-08-11 14:59:43 +02:00
{% else %}
access_log off;
{% endif %}
2020-05-25 10:30:39 +02:00
{% if nginx_error_page is defined and nginx_error_page | length > 0 %}
2018-08-09 21:20:06 +02:00
2020-05-25 10:15:42 +02:00
{% for error in nginx_error_page %}
error_page {{ error.code | join(" ") }} {{ error.dest }};
2020-05-25 10:15:42 +02:00
{% endfor %}
{% endif %}
2019-04-27 14:44:59 +02:00
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
2020-05-25 14:03:18 +02:00
{% for map in nginx_maps + nginx_maps_extra %}
2020-05-23 02:02:06 +02:00
map {{ map.input }} {{ map.output }} {
{% for param in map.parameters %}
{{ param }};
{% endfor %}
}
{% endfor %}
2019-04-27 14:44:59 +02:00
2018-08-09 21:20:06 +02:00
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
server_tokens off;
## Buffers
2018-08-11 14:59:43 +02:00
client_body_buffer_size {{ nginx_client_body_buffer_size }};
client_header_buffer_size {{ nginx_client_header_buffer_size }};
client_max_body_size {{ nginx_client_max_body_size }};
2018-08-09 21:20:06 +02:00
## Timeouts
2018-08-11 14:59:43 +02:00
client_body_timeout {{ nginx_client_body_timeout }};
client_header_timeout {{ nginx_client_header_timeout }};
keepalive_timeout {{ nginx_keepalive_timeout }};
send_timeout {{ nginx_send_timeout }};
{% if nginx_reset_timedout_connection %}
reset_timedout_connection on;
{% endif %}
2018-08-09 21:20:06 +02:00
## Gzip Settings
2018-08-11 14:59:43 +02:00
{% if nginx_gzip_enabled %}
gzip on;
gzip_comp_level {{ nginx_gzip_comp_level }};
gzip_min_length {{ nginx_gzip_min_length }};
gzip_proxied {{ nginx_gzip_proxied | join(" ") }};
gzip_types {{ nginx_gzip_types | join(" ") }};
{% endif %}
# Load modular configuration files from the /etc/nginx/conf.d directory
2018-08-09 21:20:06 +02:00
include /etc/nginx/conf.d/*.conf;
## Virtual Host Configs
include /etc/nginx/sites-enabled/*;
2018-08-11 14:59:43 +02:00
server_names_hash_bucket_size {{ nginx_server_names_hash_bucket_size }};
2017-07-15 17:24:48 +02:00
}