nGinx “site” Configuration

Especially in production environment, it’s recommened to use some form of HTTP proxy on top Node.js server. It allows to configure more secure HTTP server setup, and provides a way to run many systems on one server.

nGinx is perfect choice, below is our recommendation for nGinx reverse proxy site setup

Assuming that Node.js server will be run at 3177 port and system is meant to be accessible at, the configuration of site should be as follows:

upstream {

server {
   return 301$request_uri;

server {

   access_log  /var/log/nginx/;
   error_log  /var/log/nginx/;

   ssl on;
   ssl_certificate /etc/nginx/ssl/server.pem;
   ssl_certificate_key /etc/nginx/ssl/server.key;

   client_max_body_size 0;
   send_timeout 600s;
   location / {
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_set_header X-NginX-Proxy true;

       proxy_redirect off;

       proxy_set_header Connection '';
       proxy_http_version 1.1;
       proxy_buffering off;
       proxy_read_timeout 24h;
       chunked_transfer_encoding off;

       if ($request_filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
           add_header Access-Control-Allow-Origin *;