Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

96 wiersze
3.8 KiB

  1. #jinja2: lstrip_blocks: True
  2. # This is a custom nginx configuration file that we use in the container (instead of the default one),
  3. # because it allows us to run nginx with a non-root user.
  4. #
  5. # For this to work, the default vhost file (`/etc/nginx/conf.d/default.conf`) also needs to be removed.
  6. #
  7. # The following changes have been done compared to a default nginx configuration file:
  8. # - various temp paths are changed to `/tmp`, so that a non-root user can write to them
  9. # - the `user` directive was removed, as we don't want nginx to switch users
  10. # load_module directives must be first or nginx will choke with:
  11. # > [emerg] "load_module" directive is specified too late.
  12. {% if matrix_synapse_reverse_proxy_companion_njs_enabled %}
  13. load_module modules/ngx_http_js_module.so;
  14. {% endif %}
  15. worker_processes {{ matrix_synapse_reverse_proxy_companion_worker_processes }};
  16. error_log /var/log/nginx/error.log warn;
  17. pid /tmp/nginx.pid;
  18. {% for configuration_block in matrix_synapse_reverse_proxy_companion_additional_configuration_blocks %}
  19. {{- configuration_block }}
  20. {% endfor %}
  21. events {
  22. worker_connections {{ matrix_synapse_reverse_proxy_companion_worker_connections }};
  23. {% for configuration_block in matrix_synapse_reverse_proxy_companion_event_additional_configuration_blocks %}
  24. {{- configuration_block }}
  25. {% endfor %}
  26. }
  27. http {
  28. proxy_temp_path /tmp/proxy_temp;
  29. client_body_temp_path /tmp/client_temp;
  30. fastcgi_temp_path /tmp/fastcgi_temp;
  31. uwsgi_temp_path /tmp/uwsgi_temp;
  32. scgi_temp_path /tmp/scgi_temp;
  33. include /etc/nginx/mime.types;
  34. default_type application/octet-stream;
  35. {% if matrix_synapse_reverse_proxy_companion_njs_enabled %}
  36. js_path /njs/;
  37. {% endif %}
  38. {% if matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_enabled %}
  39. # njs module for whoami-based sync worker routing
  40. js_import whoami_sync_worker_router from whoami_sync_worker_router.js;
  41. js_shared_dict_zone zone=whoami_sync_worker_router_cache:{{ matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_cache_size_mb }}m;
  42. {% endif %}
  43. {% set access_log_format_fragments = matrix_synapse_reverse_proxy_companion_access_log_format_presets[matrix_synapse_reverse_proxy_companion_access_log_format] %}
  44. log_format access_log_fmt
  45. {% for fragment in access_log_format_fragments %}
  46. '{{ fragment }}'{% if loop.last %};{% endif %}
  47. {% endfor %}
  48. {% if matrix_synapse_reverse_proxy_companion_access_log_enabled %}
  49. access_log /var/log/nginx/access.log access_log_fmt;
  50. {% else %}
  51. access_log off;
  52. {% endif %}
  53. {% if matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_enabled %}
  54. log_format prometheus_fmt 'matrix-synapse-reverse-proxy-companion $server_name - $upstream_addr - $remote_addr - $remote_user [$time_local] '
  55. '$host "$request" '
  56. '$status "$http_referer" '
  57. '"$http_user_agent" "$http_x_forwarded_for"';
  58. access_log syslog:server={{ matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_server_port }},tag={{ matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_tag }} prometheus_fmt;
  59. {% endif %}
  60. {% if not matrix_synapse_reverse_proxy_companion_access_log_enabled and not matrix_synapse_reverse_proxy_companion_access_log_syslog_integration_enabled %}
  61. access_log off;
  62. {% endif %}
  63. proxy_connect_timeout {{ matrix_synapse_reverse_proxy_companion_proxy_connect_timeout }};
  64. proxy_send_timeout {{ matrix_synapse_reverse_proxy_companion_proxy_send_timeout }};
  65. proxy_read_timeout {{ matrix_synapse_reverse_proxy_companion_proxy_read_timeout }};
  66. send_timeout {{ matrix_synapse_reverse_proxy_companion_send_timeout }};
  67. sendfile on;
  68. #tcp_nopush on;
  69. keepalive_timeout 65;
  70. server_tokens off;
  71. {# Map directive needed for proxied WebSocket upgrades #}
  72. map $http_upgrade $connection_upgrade {
  73. default upgrade;
  74. '' close;
  75. }
  76. include /etc/nginx/conf.d/*.conf;
  77. }