Last Updated: February 25, 2016
·
589
· necenzurat

Nginx API/Somethign proxy

example:
if you are working on a Wordpress website and need a quick and dirty way to mirror all the wp-content stuff

just add this to the original nginx site config file:

location /wp-content/uploads/ {
proxy_pass  http://some-wordpress-site.com/wp-content/uploads/;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;        
proxy_set_header        X-Real-IP       $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }

and done

works as a Facebook API mirror:

location /fbapi/ {
proxy_pass  http://graph.facebook.com;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;        
proxy_set_header        X-Real-IP       $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }

best of luck