# Mirrors https://github.com/Scalingo/nginx-buildpack/blob/master/config/nginx.conf.erb

worker_processes auto;
daemon off;

events {
    worker_connections  1024;
}
http {
    # Hide nginx version information.
    server_tokens off;

    sendfile    on;
    tcp_nopush  on;
    tcp_nodelay off;

    keepalive_timeout  65;

    log_format specialLog '$http_x_forwarded_for - '
                      '"$request" $status $body_bytes_sent $request_time '
                      '"$http_referer" "$http_user_agent"';

    error_log logs/error.log notice;
    access_log logs/access.log specialLog;

    client_max_body_size 100m;
    client_body_timeout 600s;

    index index.html index.htm index.xhtml;
    include mime.types;
    default_type application/octet-stream;

    set_real_ip_from 0.0.0.0/0;
    real_ip_header X-Forwarded-For;

    root /app;

    # Enable Gzip compression.
    gzip on;
    gzip_http_version 1.0;
    gzip_comp_level 5;
    gzip_min_length 256;
    gzip_proxied any;
    gzip_vary on;
    gzip_types
      application/atom+xml
      application/javascript
      application/x-javascript
      application/json
      application/rss+xml
      application/vnd.ms-fontobject
      application/x-font-ttf
      application/x-web-app-manifest+json
      application/xhtml+xml
      application/xml
      font/opentype
      image/svg+xml
      image/x-icon
      text/css
      text/plain
      text/x-component;
    # text/html is always compressed by HttpGzipModule

    include servers.conf;

}