Skip to content

Instantly share code, notes, and snippets.

@puneetpandey
Last active August 4, 2021 06:37
Show Gist options
  • Save puneetpandey/d3781ca1d5e9c703c3d1c11846eb3f1a to your computer and use it in GitHub Desktop.
Save puneetpandey/d3781ca1d5e9c703c3d1c11846eb3f1a to your computer and use it in GitHub Desktop.
Solution for the Background requests that takes more than 60s to complete
client_max_body_size 30M;
proxy_send_timeout 600;
proxy_read_timeout 1h;
send_timeout 600;
upstream backend {
server unix:///var/run/puma/my_app.sock ;
}
server {
listen 80;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server_name *.cmgresearch.net;
large_client_header_buffers 8 32k;
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_buffers 8 32k;
proxy_buffer_size 64k;
proxy_pass http://backend;
proxy_redirect off;
location /assets {
root /var/app/current/public;
}
# enables WS support
location /cable {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment