2018-04-16 22:28:32 +02:00
|
|
|
---
|
|
|
|
- hosts: localhost
|
|
|
|
become: true
|
|
|
|
remote_user: root
|
|
|
|
roles:
|
|
|
|
- ansible-role-nginx
|
|
|
|
vars:
|
2019-02-12 16:12:40 +01:00
|
|
|
nginx_debug_output: true
|
2018-09-15 01:28:20 +02:00
|
|
|
nginx_http_template_enable: true
|
2018-10-16 20:52:04 +02:00
|
|
|
nginx_http_template:
|
2019-01-21 12:19:30 +01:00
|
|
|
app:
|
2018-10-16 20:52:04 +02:00
|
|
|
template_file: http/default.conf.j2
|
|
|
|
conf_file_name: default.conf
|
|
|
|
conf_file_location: /etc/nginx/conf.d/
|
|
|
|
port: 80
|
|
|
|
server_name: localhost
|
|
|
|
error_page: /usr/share/nginx/html
|
2019-07-15 14:49:10 +02:00
|
|
|
proxy_hide_headers:
|
|
|
|
- X-Powered-By
|
2019-06-14 12:33:50 +02:00
|
|
|
add_headers:
|
|
|
|
strict_transport_security:
|
|
|
|
name: Strict-Transport-Security
|
|
|
|
value: max-age=15768000; includeSubDomains
|
|
|
|
always: true
|
2019-01-21 12:19:30 +01:00
|
|
|
reverse_proxy:
|
2019-02-12 16:12:40 +01:00
|
|
|
proxy_cache_path:
|
|
|
|
- path: /var/cache/nginx/proxy/frontend
|
|
|
|
keys_zone:
|
|
|
|
name: frontend_proxy_cache
|
|
|
|
size: 5m
|
|
|
|
levels: "1:2"
|
|
|
|
max_size: 5g
|
|
|
|
inactive: 30m
|
|
|
|
use_temp_path: true
|
|
|
|
- path: /var/cache/nginx/proxy/backend
|
|
|
|
keys_zone:
|
|
|
|
name: backend_proxy_cache
|
|
|
|
size: 10m
|
|
|
|
levels: "1:2"
|
|
|
|
max_size: 10g
|
|
|
|
inactive: 60m
|
|
|
|
use_temp_path: true
|
|
|
|
proxy_temp_path:
|
|
|
|
path: /var/cache/nginx/proxy/temp
|
|
|
|
proxy_cache_lock: true
|
|
|
|
proxy_cache_min_uses: 5
|
|
|
|
proxy_cache_revalidate: true
|
|
|
|
proxy_cache_use_stale:
|
|
|
|
- error
|
|
|
|
- timeout
|
|
|
|
proxy_ignore_headers:
|
|
|
|
- Expires
|
2019-01-21 12:19:30 +01:00
|
|
|
locations:
|
|
|
|
frontend:
|
|
|
|
location: /
|
2019-07-15 14:49:10 +02:00
|
|
|
proxy_hide_headers:
|
|
|
|
- X-Powered-By
|
2019-06-14 12:33:50 +02:00
|
|
|
add_headers:
|
|
|
|
strict_transport_security:
|
|
|
|
name: Strict-Transport-Security
|
|
|
|
value: max-age=15768000; includeSubDomains
|
|
|
|
always: true
|
|
|
|
another_header:
|
|
|
|
name: Fancy-New-Header-To-Test
|
|
|
|
value: testing=true
|
|
|
|
always: false
|
2019-01-21 12:19:30 +01:00
|
|
|
proxy_pass: http://frontend_servers/
|
2019-02-12 16:12:40 +01:00
|
|
|
proxy_cache: frontend_proxy_cache
|
|
|
|
proxy_temp_path:
|
|
|
|
path: /var/cache/nginx/proxy/frontend/temp
|
|
|
|
proxy_cache_lock: false
|
|
|
|
proxy_cache_min_uses: 3
|
|
|
|
proxy_cache_revalidate: false
|
|
|
|
proxy_cache_use_stale:
|
|
|
|
- http_403
|
|
|
|
- http_404
|
|
|
|
proxy_ignore_headers:
|
|
|
|
- Vary
|
|
|
|
- Cache-Control
|
2019-02-18 15:23:57 +01:00
|
|
|
proxy_redirect: false
|
2019-04-18 11:51:44 +02:00
|
|
|
proxy_set_header:
|
|
|
|
header_host:
|
|
|
|
name: Host
|
|
|
|
value: $host
|
|
|
|
header_x_real_ip:
|
|
|
|
name: X-Real-IP
|
|
|
|
value: $remote_addr
|
|
|
|
header_x_forwarded_for:
|
|
|
|
name: X-Forwarded-For
|
|
|
|
value: $proxy_add_x_forwarded_for
|
|
|
|
header_x_forwarded_proto:
|
|
|
|
name: X-Forwarded-Proto
|
|
|
|
value: $scheme
|
2019-07-15 14:41:19 +02:00
|
|
|
proxy_buffering: false
|
2019-01-21 12:19:30 +01:00
|
|
|
backend:
|
|
|
|
location: /backend
|
|
|
|
proxy_pass: http://backend_servers/
|
2019-02-12 16:12:40 +01:00
|
|
|
proxy_cache: backend_proxy_cache
|
|
|
|
proxy_temp_path:
|
|
|
|
path: /var/cache/nginx/proxy/backend/temp
|
|
|
|
proxy_cache_lock: true
|
|
|
|
proxy_cache_min_uses: 2
|
|
|
|
proxy_cache_revalidate: true
|
|
|
|
proxy_cache_use_stale:
|
|
|
|
- http_500
|
|
|
|
- http_502
|
|
|
|
- http_503
|
2019-02-18 15:23:57 +01:00
|
|
|
proxy_redirect: default
|
2019-04-18 11:51:44 +02:00
|
|
|
proxy_set_header:
|
|
|
|
header_host:
|
|
|
|
name: Host
|
|
|
|
value: $host
|
|
|
|
header_x_real_ip:
|
|
|
|
name: X-Real-IP
|
|
|
|
value: $remote_addr
|
|
|
|
header_x_forwarded_for:
|
|
|
|
name: X-Forwarded-For
|
|
|
|
value: $proxy_add_x_forwarded_for
|
|
|
|
header_x_forwarded_proto:
|
|
|
|
name: X-Forwarded-Proto
|
|
|
|
value: $scheme
|
2019-01-21 12:19:30 +01:00
|
|
|
upstreams:
|
2019-02-06 13:39:48 +01:00
|
|
|
frontend_upstream:
|
2019-01-21 12:19:30 +01:00
|
|
|
name: frontend_servers
|
|
|
|
lb_method: least_conn
|
2019-02-12 16:12:40 +01:00
|
|
|
zone_name: frontend_mem_zone
|
2019-01-21 12:19:30 +01:00
|
|
|
zone_size: 64k
|
|
|
|
sticky_cookie: false
|
|
|
|
servers:
|
|
|
|
frontend_server_1:
|
|
|
|
address: localhost
|
|
|
|
port: 8081
|
|
|
|
weight: 1
|
|
|
|
health_check: max_fails=3 fail_timeout=5s
|
2019-02-06 13:39:48 +01:00
|
|
|
backend_upstream:
|
2019-01-21 12:19:30 +01:00
|
|
|
name: backend_servers
|
|
|
|
lb_method: least_conn
|
2019-02-12 16:12:40 +01:00
|
|
|
zone_name: backend_mem_zone
|
2019-01-21 12:19:30 +01:00
|
|
|
zone_size: 64k
|
|
|
|
sticky_cookie: false
|
|
|
|
servers:
|
|
|
|
backend_server_1:
|
|
|
|
address: localhost
|
|
|
|
port: 8082
|
|
|
|
weight: 1
|
|
|
|
health_check: max_fails=3 fail_timeout=5s
|
|
|
|
frontend:
|
|
|
|
template_file: http/default.conf.j2
|
|
|
|
conf_file_name: frontend_default.conf
|
|
|
|
conf_file_location: /etc/nginx/conf.d/
|
|
|
|
port: 8081
|
|
|
|
server_name: localhost
|
|
|
|
error_page: /usr/share/nginx/html
|
|
|
|
autoindex: false
|
|
|
|
web_server:
|
|
|
|
locations:
|
2019-02-06 13:39:48 +01:00
|
|
|
frontend_site:
|
2019-01-21 12:19:30 +01:00
|
|
|
location: /
|
2019-07-15 14:49:10 +02:00
|
|
|
proxy_hide_headers:
|
|
|
|
- X-Powered-By
|
2019-01-21 12:19:30 +01:00
|
|
|
html_file_location: /usr/share/nginx/html
|
|
|
|
html_file_name: frontend_index.html
|
|
|
|
autoindex: false
|
|
|
|
http_demo_conf: true
|
|
|
|
backend:
|
|
|
|
template_file: http/default.conf.j2
|
|
|
|
conf_file_name: backend_default.conf
|
|
|
|
conf_file_location: /etc/nginx/conf.d/
|
|
|
|
port: 8082
|
|
|
|
server_name: localhost
|
|
|
|
error_page: /usr/share/nginx/html
|
2018-11-26 20:06:46 +01:00
|
|
|
autoindex: false
|
2018-10-16 20:52:04 +02:00
|
|
|
web_server:
|
2018-11-19 05:10:19 +01:00
|
|
|
locations:
|
2019-02-06 13:39:48 +01:00
|
|
|
backend_site:
|
2018-11-19 05:10:19 +01:00
|
|
|
location: /
|
|
|
|
html_file_location: /usr/share/nginx/html
|
2019-01-21 12:19:30 +01:00
|
|
|
html_file_name: backend_index.html
|
2018-11-26 20:06:46 +01:00
|
|
|
autoindex: false
|
2019-01-21 12:19:30 +01:00
|
|
|
http_demo_conf: true
|
|
|
|
nginx_html_demo_template_enable: true
|
|
|
|
nginx_html_demo_template:
|
|
|
|
frontend:
|
|
|
|
template_file: www/index.html.j2
|
|
|
|
html_file_name: frontend_index.html
|
|
|
|
html_file_location: /usr/share/nginx/html
|
|
|
|
web_server_name: Frontend
|
|
|
|
backend:
|
|
|
|
template_file: www/index.html.j2
|
|
|
|
html_file_name: backend_index.html
|
|
|
|
html_file_location: /usr/share/nginx/html
|
|
|
|
web_server_name: Backend
|