KarrLab/datanator_rest_api

View on GitHub
nginx/default.conf

Summary

Maintainability
Test Coverage
worker_processes auto;
worker_cpu_affinity auto;

# 'user nobody nobody;' for systems with 'nobody' as a group instead
error_log  /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
  worker_connections 1024; # increase if you have lots of clients
  accept_mutex off; # set to 'on' if nginx worker_processes > 1
  # 'use epoll;' to enable for Linux 2.6+
  # 'use kqueue;' to enable for FreeBSD, OSX
}

http {
  log_format upstream_time '$remote_addr - $remote_user [$time_local] '
                            '"$request" $status $body_bytes_sent '
                            '"$http_referer" "$http_user_agent"'
                            ' rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"';
  include mime.types;
  # fallback in case we can't determine a type
  default_type application/octet-stream;
  access_log /var/log/nginx/access.log upstream_time;
  sendfile on;

  server {
    # use 'listen 80 deferred;' for Linux
    # use 'listen 80 accept_filter=httpready;' for FreeBSD
    listen 80 deferred;
    client_max_body_size 4G;
    keepalive_timeout 5;

    gzip on;
    gzip_types      text/plain application/xml text/html;
    gzip_proxied    no-cache no-store private expired auth;
    gzip_min_length 1000;
    
    location / {      
      proxy_pass          http://127.0.0.1:8001;
      proxy_http_version  1.1;
      proxy_redirect      off;
      proxy_read_timeout  300s;
      proxy_connect_timeout 75s;
      proxy_buffering     off;
      proxy_set_header    Host $http_host;
      proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header    X-Forwarded-Proto $scheme;
    }
  }
}