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 06:59:41 +00:00
{{ ansible_managed | comment }}
2017-12-24 13:05:27 +00:00
user {{ nginx_user }} {{ nginx_group }};
2017-12-24 16:36:43 +00:00
worker_processes {{ nginx_worker_processes }};
2017-07-15 15:24:48 +00:00
2018-12-01 22:23:43 +00:00
pid /var/run/nginx.pid;
2017-07-15 15:24:48 +00:00
events {
2018-08-09 19:20:06 +00:00
worker_connections {{ nginx_worker_connections }};
2017-07-15 15:24:48 +00:00
}
http {
2018-08-09 19:20:06 +00: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 12:59:43 +00:00
error_log {{ nginx_error_log.file }} {{ nginx_error_log.level }};
{% else %}
error_log off;
{% endif %}
{% if nginx_access_log.enabled %}
2018-08-11 13:27:27 +00:00
access_log {{ nginx_access_log.file }} {{ nginx_access_log.format }};
2018-08-11 12:59:43 +00:00
{% else %}
access_log off;
{% endif %}
2020-05-25 08:30:39 +00:00
{% if nginx_error_page is defined and nginx_error_page | length > 0 %}
2018-08-09 19:20:06 +00:00
2020-05-25 08:15:42 +00:00
{% for error in nginx_error_page %}
error_page {{ error.code | join(" ") }} {{ error.dest }};
2020-05-25 08:15:42 +00:00
{% endfor %}
{% endif %}
2019-04-27 12:44:59 +00:00
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
{% for map in nginx_maps %}
2020-05-23 00:02:06 +00:00
map {{ map.input }} {{ map.output }} {
{% for param in map.parameters %}
{{ param }};
{% endfor %}
}
{% endfor %}
2019-04-27 12:44:59 +00:00
2018-08-09 19:20:06 +00:00
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
server_tokens off;
## Buffers
2018-08-11 12:59:43 +00: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 19:20:06 +00:00
## Timeouts
2018-08-11 12:59:43 +00: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 19:20:06 +00:00
## Gzip Settings
2018-08-11 12:59:43 +00: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 19:20:06 +00:00
include /etc/nginx/conf.d/*.conf;
## Virtual Host Configs
include /etc/nginx/sites-enabled/*;
2018-08-11 12:59:43 +00:00
server_names_hash_bucket_size {{ nginx_server_names_hash_bucket_size }};
2017-07-15 15:24:48 +00:00
}