How to configure nginx as a proxy
Posted by Prem on February 6th, 2009 filed in nginxThis is the typical conf file to configure nginx as proxy
server {
listen 80;
server_name your.domain.com;
#some default rewrites
if ( $remote_addr = 127.0.0.1 ) {
rewrite ^(.*)$ /500.html last;
return 302;
}
location / {
proxy_pass http://proxy_config;
proxy_buffering on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
error_page 500 501 = /500.html;
error_page 502 503 504 = /502.html;
}
location /500.html {
root /var/www/nginx-default;
}
location /502.html {
root /var/www/nginx-default;
}
}