upstream dillinger { server dillinger1:80; server dillinger2:80; server dillinger3:80; server dillinger4:80; } server { proxy_temp_path /var/tmp; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; gzip_comp_level 6; gzip_vary on; gzip_min_length 1000; gzip_proxied any; gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_buffers 16 8k; listen 80; server_name www.dillinger.io dillinger.io; access_log /var/log/nginx/nginx.access.dillinger.log; error_log /var/log/nginx/nginx_error.dillinger.log debug; # Serve static assets with nginx, not N|Solid location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) { root /var/sites/dillinger/public; access_log off; expires max; } location / { proxy_redirect off; proxy_pass http://dillinger; # Load balance the URL location "/" to the upstream dillinger proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/nginx-default; } }