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

86 lines
2.4 KiB
Django/Jinja

#jinja2: lstrip_blocks: True
{{ ansible_managed | comment }}
user {{ nginx_user }} {{ nginx_group }};
worker_processes {{ nginx_worker_processes }};
pid /var/run/nginx.pid;
events {
worker_connections {{ nginx_worker_connections }};
}
http {
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 %}
error_log {{ nginx_error_log.file }} {{ nginx_error_log.level }};
{% else %}
error_log off;
{% endif %}
{% if nginx_access_log.enabled %}
access_log {{ nginx_access_log.file }} {{ nginx_access_log.format }};
{% else %}
access_log off;
{% endif %}
{% if nginx_error_page is defined and nginx_error_page | length > 0 %}
{% for error in nginx_error_page %}
error_page {{ error.code | join(" ") }} {{ error.dest }};
{% endfor %}
{% endif %}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
{% for map in nginx_maps + nginx_maps_extra %}
map {{ map.input }} {{ map.output }} {
{% for param in map.parameters %}
{{ param }};
{% endfor %}
}
{% endfor %}
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
server_tokens off;
## Buffers
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 }};
## Timeouts
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 %}
## Gzip Settings
{% 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
include /etc/nginx/conf.d/*.conf;
## Virtual Host Configs
include /etc/nginx/sites-enabled/*;
server_names_hash_bucket_size {{ nginx_server_names_hash_bucket_size }};
}