Use more vars instead of a bug dirty dict

pull/14/head
Emilien Mantel 2015-12-09 16:46:50 +01:00
parent f8d138828b
commit 05cb864c7c
3 changed files with 69 additions and 45 deletions

View File

@ -42,9 +42,9 @@ Socket:
- `nginx_user` - `nginx_user`
- `nginx_worker_processes` - `nginx_worker_processes`
- `nginx_events`: key/value in events block
- `nginx_http`: key/value in http block
- `nginx_pid`: daemon pid file - `nginx_pid`: daemon pid file
- `nginx_events_*`: all variables in events block
- `nginx_http_*`: all variables in http block
### Vhost management ### Vhost management

View File

@ -33,43 +33,45 @@ nginx_upstreams: []
nginx_user: 'www-data' nginx_user: 'www-data'
nginx_worker_processes: '{{ ansible_processor_vcpus }}' nginx_worker_processes: '{{ ansible_processor_vcpus }}'
nginx_events: #
worker_connections: '512' # Nginx events
multi_accept: 'on' #
use: 'epoll' nginx_events_worker_connections: '512'
nginx_events_multi_accept: 'on'
nginx_events_use: 'epoll'
# #
# Nginx HTTP # Nginx HTTP
# #
nginx_http: nginx_http_types_hash_max_size: 2048
access_log: 'off' nginx_http_default_type: 'application/octet-stream'
error_log: 'off' nginx_http_access_log: 'off'
client_body_buffer_size: '1M' nginx_http_error_log: 'off'
client_header_buffer_size: '1M' nginx_http_client_body_buffer_size: '1M'
client_max_body_size: '10M' nginx_http_client_header_buffer_size: '1M'
large_client_header_buffers: '8 8k' nginx_http_client_max_body_size: '10M'
client_body_timeout: '60' nginx_http_large_client_header_buffers: '8 8k'
client_header_timeout: '60' nginx_http_client_body_timeout: '60'
keepalive_timeout: '30 30' nginx_http_client_header_timeout: '60'
send_timeout: '120' nginx_http_keepalive_timeout: '30 30'
ignore_invalid_headers: 'on' nginx_http_send_timeout: '120'
keepalive_requests: '100' nginx_http_ignore_invalid_headers: 'on'
recursive_error_pages: 'on' nginx_http_keepalive_requests: '100'
sendfile: 'on' nginx_http_recursive_error_pages: 'on'
server_name_in_redirect: 'off' nginx_http_sendfile: 'on'
server_tokens: 'off' nginx_http_server_name_in_redirect: 'off'
tcp_nodelay: 'on' nginx_http_server_tokens: 'off'
tcp_nopush: 'on' nginx_http_tcp_nodelay: 'on'
reset_timedout_connection: 'on' nginx_http_tcp_nopush: 'on'
gzip: 'on' nginx_http_reset_timedout_connection: 'on'
gzip_buffers: '16 8k' nginx_http_gzip: 'on'
gzip_comp_level: '9' nginx_http_gzip_buffers: '16 8k'
gzip_http_version: '1.0' nginx_http_gzip_comp_level: '9'
gzip_min_length: '0' nginx_http_gzip_http_version: '1.0'
gzip_types: 'text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml' nginx_http_gzip_min_length: '0'
gzip_vary: 'on' nginx_http_gzip_types: 'text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml'
gzip_disable: '"msie6"' nginx_http_gzip_vary: 'on'
# etag: 'off' nginx_http_gzip_disable: '"msie6"'
# #
# Vhosts # Vhosts

View File

@ -7,21 +7,43 @@ worker_processes {{ nginx_worker_processes }};
pid {{ nginx_pid }}; pid {{ nginx_pid }};
events { events {
{% for key, value in nginx_events.iteritems() %} worker_connections {{ nginx_events_worker_connections }};
{{ "\t%-30s %s" | format(key, value) }}; multi_accept {{ nginx_events_multi_accept }};
{% endfor %} use {{ nginx_events_use }};
} }
http { http {
types_hash_max_size 2048; types_hash_max_size {{ nginx_http_types_hash_max_size }};
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream;
# From Ansible default_type {{ nginx_http_default_type }};
{% for key, value in nginx_http.iteritems() %} access_log {{ nginx_http_access_log }};
{{ "\t%-30s %s" | format(key, value) }}; error_log {{ nginx_http_error_log }};
{% endfor %} client_body_buffer_size {{ nginx_http_client_body_buffer_size }};
# /From Ansible client_header_buffer_size {{ nginx_http_client_header_buffer_size }};
client_max_body_size {{ nginx_http_client_max_body_size }};
large_client_header_buffers {{ nginx_http_large_client_header_buffers }};
client_body_timeout {{ nginx_http_client_body_timeout }};
client_header_timeout {{ nginx_http_client_header_timeout }};
keepalive_timeout {{ nginx_http_keepalive_timeout }};
send_timeout {{ nginx_http_send_timeout }};
ignore_invalid_headers {{ nginx_http_ignore_invalid_headers }};
keepalive_requests {{ nginx_http_keepalive_requests }};
recursive_error_pages {{ nginx_http_recursive_error_pages }};
sendfile {{ nginx_http_sendfile }};
server_name_in_redirect {{ nginx_http_server_name_in_redirect }};
server_tokens {{ nginx_http_server_tokens }};
tcp_nodelay {{ nginx_http_tcp_nodelay }};
tcp_nopush {{ nginx_http_tcp_nopush }};
reset_timedout_connection {{ nginx_http_reset_timedout_connection }};
gzip {{ nginx_http_gzip }};
gzip_buffers {{ nginx_http_gzip_buffers }};
gzip_comp_level {{ nginx_http_gzip_comp_level }};
gzip_http_version {{ nginx_http_gzip_http_version }};
gzip_min_length {{ nginx_http_gzip_min_length }};
gzip_types {{ nginx_http_gzip_types }};
gzip_vary {{ nginx_http_gzip_vary }};
gzip_disable {{ nginx_http_gzip_disable }};
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*; include /etc/nginx/sites-enabled/*;