worker_processes  2;
<% if @passenger_dynamic_module_conf_file %>
    include <%= @passenger_dynamic_module_conf_file %>;
<% end %>

error_log '<%= @log_file %>';
pid       <%= @nginx_root %>/nginx.pid;

# Makes integration tests work when run in a CentOS container, with Node.js
# and Python installed through SCL.
env PATH;
env LD_LIBRARY_PATH;
env PYTHONPATH;

events {
    worker_connections  1024;
}

http {
    include            <%= TEMPLATE_DIR %>/mime.types;
    default_type       application/octet-stream;
    sendfile           on;
    keepalive_timeout  65;
    server_names_hash_bucket_size 64;
    
    client_body_temp_path <%= @nginx_root %>;
    log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log <%= @nginx_root %>/access.log main;

    passenger_root <%= @passenger_root %>;
    passenger_ruby <%= PlatformInfo.ruby_command %>;
    passenger_nodejs <%= PlatformInfo.find_command('node') %>;
    passenger_default_user <%= CONFIG['default_user'] %>;
    passenger_default_group <%= CONFIG['default_group'] %>;
    passenger_max_pool_size <%= @max_pool_size %>;
    passenger_log_level 7;
    passenger_turbocaching off;
    passenger_disable_security_update_check on;
    passenger_disable_anonymous_telemetry on;
    <% if @stat_throttle_rate %>passenger_stat_throttle_rate <%= @stat_throttle_rate %>;<% end %>

    <% for server in @servers %>
        server {
            listen <%= @port %>;
            <% server.values.each_pair do |key, value| %>
                <%= key %> <%= value %>;
            <% end %>
            <%= server.extra %>
        }
    <% end %>
    
    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
