- the nginx access log wil be written to /matrix/nginx-proxy/access.log - the log will not be forwarded to the systemd journal anymorepull/213/head
| @@ -25,6 +25,9 @@ matrix_nginx_proxy_container_additional_volumes: [] | |||||
| # A list of extra arguments to pass to the container | # A list of extra arguments to pass to the container | ||||
| matrix_nginx_proxy_container_extra_arguments: [] | matrix_nginx_proxy_container_extra_arguments: [] | ||||
| # Controls whether nginx logs access to stdout of the container (and so to journald) or to the file /matrix/nginx-proxy/access.log | |||||
| matrix_nginx_access_log_to_file: false | |||||
| # Controls whether matrix-nginx-proxy should serve the base domain. | # Controls whether matrix-nginx-proxy should serve the base domain. | ||||
| # | # | ||||
| # This is useful for when you only have your Matrix server, but you need to serve | # This is useful for when you only have your Matrix server, but you need to serve | ||||
| @@ -115,6 +115,14 @@ | |||||
| daemon_reload: yes | daemon_reload: yes | ||||
| when: "matrix_nginx_proxy_enabled and matrix_nginx_proxy_systemd_service_result.changed" | when: "matrix_nginx_proxy_enabled and matrix_nginx_proxy_systemd_service_result.changed" | ||||
| - name: Ensure Matrix nginx-proxy access.log file exist | |||||
| file: | |||||
| path: "{{ matrix_nginx_proxy_base_path }}/access.log" | |||||
| state: touch | |||||
| mode: 0644 | |||||
| owner: "{{ matrix_user_username }}" | |||||
| group: "{{ matrix_user_username }}" | |||||
| when: matrix_nginx_access_log_to_file|bool | |||||
| # | # | ||||
| # Tasks related to getting rid of matrix-nginx-proxy (if it was previously enabled) | # Tasks related to getting rid of matrix-nginx-proxy (if it was previously enabled) | ||||
| @@ -186,3 +194,9 @@ | |||||
| path: "{{ matrix_nginx_proxy_data_path }}/matrix-synapse-metrics-htpasswd" | path: "{{ matrix_nginx_proxy_data_path }}/matrix-synapse-metrics-htpasswd" | ||||
| state: absent | state: absent | ||||
| when: "not matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_enabled|bool or not matrix_nginx_proxy_proxy_synapse_metrics|bool" | when: "not matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_enabled|bool or not matrix_nginx_proxy_proxy_synapse_metrics|bool" | ||||
| - name: Ensure Matrix nginx-proxy configuration for base domain deleted | |||||
| file: | |||||
| path: "{{ matrix_nginx_proxy_base_path }}/access.log" | |||||
| state: absent | |||||
| when: "not matrix_nginx_proxy_enabled|bool" | |||||
| @@ -33,7 +33,11 @@ http { | |||||
| '$status $body_bytes_sent "$http_referer" ' | '$status $body_bytes_sent "$http_referer" ' | ||||
| '"$http_user_agent" "$http_x_forwarded_for"'; | '"$http_user_agent" "$http_x_forwarded_for"'; | ||||
| {% if matrix_nginx_access_log_to_file %} | |||||
| access_log /var/log/nginx/access_file.log main; | |||||
| {% else %} | |||||
| access_log /var/log/nginx/access.log main; | access_log /var/log/nginx/access.log main; | ||||
| {% endif %} | |||||
| sendfile on; | sendfile on; | ||||
| #tcp_nopush on; | #tcp_nopush on; | ||||
| @@ -31,6 +31,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-nginx-proxy \ | |||||
| -v {{ matrix_nginx_proxy_confd_path }}:/etc/nginx/conf.d:ro \ | -v {{ matrix_nginx_proxy_confd_path }}:/etc/nginx/conf.d:ro \ | ||||
| -v {{ matrix_ssl_config_dir_path }}:{{ matrix_ssl_config_dir_path }}:ro \ | -v {{ matrix_ssl_config_dir_path }}:{{ matrix_ssl_config_dir_path }}:ro \ | ||||
| -v {{ matrix_static_files_base_path }}:{{ matrix_static_files_base_path }}:ro \ | -v {{ matrix_static_files_base_path }}:{{ matrix_static_files_base_path }}:ro \ | ||||
| {% if matrix_nginx_access_log_to_file %} | |||||
| -v {{ matrix_nginx_proxy_base_path }}/access.log:/var/log/nginx/access_file.log:rw \ | |||||
| {% endif %} | |||||
| {% for volume in matrix_nginx_proxy_container_additional_volumes %} | {% for volume in matrix_nginx_proxy_container_additional_volumes %} | ||||
| -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \ | -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \ | ||||
| {% endfor %} | {% endfor %} | ||||