nginx.conf.j2 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #gzip on;
  32. {% if nginx_proxy_cache_path %}
  33. proxy_cache_path {{ nginx_proxy_cache_path }};
  34. {% endif %}
  35. {% endblock %}
  36. {% if nginx_extra_http_options %}
  37. {{ nginx_extra_http_options|indent(4, False) }}
  38. {% endif %}
  39. {% block http_upstream %}
  40. {% for upstream in nginx_upstreams %}
  41. upstream {{ upstream.name }} {
  42. {% if upstream.strategy is defined %}
  43. {{ upstream.strategy }};
  44. {% endif %}
  45. {% for server in upstream.servers %}
  46. server {{ server }};
  47. {% endfor %}
  48. {% if upstream.keepalive is defined %}
  49. keepalive {{ upstream.keepalive }};
  50. {% endif %}
  51. }
  52. {% endfor %}
  53. {% endblock %}
  54. {% block http_includes %}
  55. include {{ nginx_conf_path }}/*.conf;
  56. {% if nginx_conf_path != nginx_vhost_path %}
  57. include {{ nginx_vhost_path }}/*;
  58. {% endif %}
  59. {% endblock %}
  60. {% block http_end %}{% endblock %}
  61. }