Skip to content

Instantly share code, notes, and snippets.

@athiwatc
Created June 24, 2013 00:02
Show Gist options
  • Save athiwatc/5846998 to your computer and use it in GitHub Desktop.
Save athiwatc/5846998 to your computer and use it in GitHub Desktop.
NGINX
worker_processes 5;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
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
server_name gw2event.exitosus.com;
location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|font/|fonts/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) {
root /home/www/gw2event/static;
access_log off;
expires max;
}
location ~* \.(js|css)$ {
root /home/www/gw2event/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