added x-forward-ip support
This commit is contained in:
parent
0e8c531d0b
commit
b0fe6bb0ee
5 changed files with 16 additions and 2 deletions
|
|
@ -3,6 +3,9 @@ resolver:
|
||||||
- 8.8.4.4
|
- 8.8.4.4
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
|
real_ip_from:
|
||||||
|
"127.0.0.1": {}
|
||||||
|
"::1": {}
|
||||||
monitoring: true
|
monitoring: true
|
||||||
serverpki: true
|
serverpki: true
|
||||||
php: false
|
php: false
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
- name: execute ssl template
|
- name: execute ssl template
|
||||||
template:
|
template:
|
||||||
src: ssl_files.j2
|
src: ssl_files.conf.j2
|
||||||
dest: /etc/nginx/conf.d/ssl_files.conf
|
dest: /etc/nginx/conf.d/ssl_files.conf
|
||||||
notify:
|
notify:
|
||||||
- restart nginx
|
- restart nginx
|
||||||
|
|
@ -37,10 +37,17 @@
|
||||||
notify:
|
notify:
|
||||||
- restart nginx
|
- restart nginx
|
||||||
|
|
||||||
|
- name: execute proxy template
|
||||||
|
template:
|
||||||
|
src: proxy.conf.j2
|
||||||
|
dest: /etc/nginx/conf.d/proxy.conf
|
||||||
|
notify:
|
||||||
|
- restart nginx
|
||||||
|
|
||||||
- name: create nginx vhosts
|
- name: create nginx vhosts
|
||||||
template:
|
template:
|
||||||
|
src: vhost.conf.j2
|
||||||
dest: "/etc/nginx/sites-available/{{ item.key }}"
|
dest: "/etc/nginx/sites-available/{{ item.key }}"
|
||||||
src: vhost.j2
|
|
||||||
with_dict: "{{ nginx.vhosts }}"
|
with_dict: "{{ nginx.vhosts }}"
|
||||||
notify:
|
notify:
|
||||||
- restart nginx
|
- restart nginx
|
||||||
|
|
|
||||||
4
templates/proxy.conf.j2
Normal file
4
templates/proxy.conf.j2
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{% for ip in nginx.real_ip_from %}
|
||||||
|
set_real_ip_from {{ ip }};
|
||||||
|
{% endfor %}
|
||||||
|
real_ip_header X-Forwarded-For;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue