nginx.conf.j2 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. user {{ nginx_user }};
  2. error_log {{ nginx_error_log }};
  3. pid {{ nginx_pidfile }};
  4. {% block worker %}
  5. worker_processes {{ nginx_worker_processes }};
  6. {% endblock %}
  7. {% block events %}
  8. events {
  9. worker_connections {{ nginx_worker_connections }};
  10. multi_accept {{ nginx_multi_accept }};
  11. }
  12. {% endblock %}
  13. {% if nginx_extra_conf_options %}
  14. {{ nginx_extra_conf_options }}
  15. {% endif %}
  16. http {
  17. {% block http_begin %}{% endblock %}
  18. {% block http_basic %}
  19. include {{ nginx_mime_file_path }};
  20. default_type application/octet-stream;
  21. server_names_hash_bucket_size {{ nginx_server_names_hash_bucket_size }};
  22. client_max_body_size {{ nginx_client_max_body_size }};
  23. log_format main {{ nginx_log_format|indent(23) }};
  24. access_log {{ nginx_access_log }};
  25. sendfile {{ nginx_sendfile }};
  26. tcp_nopush {{ nginx_tcp_nopush }};
  27. tcp_nodelay {{ nginx_tcp_nodelay }};
  28. keepalive_timeout {{ nginx_keepalive_timeout }};
  29. keepalive_requests {{ nginx_keepalive_requests }};
  30. server_tokens {{ nginx_server_tokens }};
  31. {% if nginx_proxy_cache_path %}
  32. proxy_cache_path {{ nginx_proxy_cache_path }};
  33. {% endif %}
  34. {% endblock %}
  35. {% block http_gzip %}
  36. # gzip on;
  37. {% endblock %}
  38. {% if nginx_extra_http_options %}
  39. {{ nginx_extra_http_options|indent(4, False) }}
  40. {% endif %}
  41. {% block http_upstream %}
  42. {% for upstream in nginx_upstreams %}
  43. upstream {{ upstream.name }} {
  44. {% if upstream.strategy is defined %}
  45. {{ upstream.strategy }};
  46. {% endif %}
  47. {% for server in upstream.servers %}
  48. server {{ server }};
  49. {% endfor %}
  50. {% if upstream.keepalive is defined %}
  51. keepalive {{ upstream.keepalive }};
  52. {% endif %}
  53. }
  54. {% endfor %}
  55. {% endblock %}
  56. {% block http_includes %}
  57. include {{ nginx_conf_path }}/*.conf;
  58. {% if nginx_conf_path != nginx_vhost_path %}
  59. include {{ nginx_vhost_path }}/*;
  60. {% endif %}
  61. {% endblock %}
  62. {% block http_end %}{% endblock %}
  63. }