add nginx proxy variables
This commit is contained in:
parent
573067db25
commit
34536084af
@ -87,7 +87,7 @@ matrix_iptables_enabled: False
|
|||||||
matrix_open_ports:
|
matrix_open_ports:
|
||||||
- name: allow_matrix_web
|
- name: allow_matrix_web
|
||||||
rules: |
|
rules: |
|
||||||
-A INPUT -m state --state NEW -p tcp --dport {{ matrix_bind_port }} -j ACCEPT
|
-A INPUT -m state --state NEW -p tcp --dport {{ matrix_http_bind_port }} -j ACCEPT
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
matrix_tls_enabled: False
|
matrix_tls_enabled: False
|
||||||
@ -104,3 +104,5 @@ matrix_nginx_iptables_enabled: False
|
|||||||
matrix_nginx_tls_enabled: False
|
matrix_nginx_tls_enabled: False
|
||||||
matrix_nginx_tls_cert_file: matrix-cert.pem
|
matrix_nginx_tls_cert_file: matrix-cert.pem
|
||||||
matrix_nginx_tls_key_file: matrix-key.pem
|
matrix_nginx_tls_key_file: matrix-key.pem
|
||||||
|
matrix_nginx_proxy_port: "{{ matrix_http_bind_port }}"
|
||||||
|
matrix_nginx_proxy_ip: "{{ matrix_http_bind_ips[0] }}"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#jinja2: lstrip_blocks: True
|
#jinja2: lstrip_blocks: True
|
||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
upstream backend_matrix {
|
upstream backend_matrix {
|
||||||
server {{ matrix_bind_ip }}:{{ matrix_bind_port }};
|
server {{ matrix_nginx_proxy_ip }}:{{ matrix_nginx_proxy_port }};
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
@ -14,7 +14,7 @@ server {
|
|||||||
return 301 https://$server_name$request_uri;
|
return 301 https://$server_name$request_uri;
|
||||||
{% else %}
|
{% else %}
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://backend_matrix;
|
proxy_pass {{ 'https' if matrix_tls_enabled else 'http' }}://backend_matrix;
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -28,7 +28,7 @@ server {
|
|||||||
client_max_body_size 200M;
|
client_max_body_size 200M;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://backend_matrix;
|
proxy_pass {{ 'https' if matrix_tls_enabled else 'http' }}://backend_matrix;
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user