Skip to content

Instantly share code, notes, and snippets.

@jaigouk
Forked from fightingtheboss/nginx.conf
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaigouk/bc095e842b0ef651407b to your computer and use it in GitHub Desktop.
Save jaigouk/bc095e842b0ef651407b to your computer and use it in GitHub Desktop.
upstream haproxy {
server 127.0.0.1:9000;
}
upstream stats {
server 127.0.0.1:9999;
}
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
# Make site accessible from http://localhost/
server_name localhost;
location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|font/|fonts/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) {
root /home/deploy/www/pegleg/current/bundle/static;
access_log off;
expires max;
}
location ~* \.(js|css)$ {
root /home/deploy/www/pegleg/current/bundle/static_cacheable;
access_log off;
expires max;
}
location /haproxy {
proxy_redirect off;
proxy_pass http://stats;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
proxy_redirect off;
proxy_pass http://haproxy;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_set_header Host $host;
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