ansible-role-nginx/templates/nginx.conf.j2
2023-03-11 21:39:23 +01:00

78 lines
1.6 KiB
Django/Jinja

# Managed by Ansible
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens {{ nginx_server_token | default(off) }};
map_hash_max_size 4096;
map_hash_bucket_size 128;
server_names_hash_bucket_size 128;
client_max_body_size 0;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
log_format noip '0.0.0.0 - $remote_user [$time_local] '
'"$host" "$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$request_time" seconds';
# Log no IP addresses
# access_log /var/log/nginx/access.log noip if=$log_ip;
access_log {{ nginx_access_log | default(off) }};
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
{% if nginx_gzip is defined and nginx_gzip %}
gzip on;
{% if nginx_type == 'gateway' %}
gzip_proxied any;
{% endif %}
gzip_static on;
gzip_http_version {{ nginx_http_version }};
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
gzip_comp_level 6;
gzip_types
{% for type in nginx_gzip_types %}
{{ type }}
{% endfor %}
gzip_buffers 16 8k;
gzip_min_length 512;
{% else %}
gzip off;
{% endif %}
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}