Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of proxy config for NGINX (version 1.3.13+)
upstream backend {
server {
listen 80;
access_log /var/log/nginx/yoursite.access.log;
error_log /var/log/nginx/yoursite.error.log;
# prevents 502 bad gateway error
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;
# prevents 502 bad gateway error
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_pass http://backend;
proxy_redirect off;
# enables WS support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Copy link

Bubelbub commented Aug 30, 2014

Doesnt work for me.
I got more errors than before :O

404 not found.

Fixed in
Line 32.

Copy link

webmakin commented Jan 9, 2015

Thank you, this solved a totally different issue for me.

Copy link

prdonahue commented Apr 15, 2015

Excellent gist, thanks. Was having trouble until I added the "proxy_redirect off;" (client was complaining of "unknown code 301").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment