Skip to content

Instantly share code, notes, and snippets.

@omgbbqhaxx
Created June 19, 2013 22:21
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 omgbbqhaxx/5818661 to your computer and use it in GitHub Desktop.
Save omgbbqhaxx/5818661 to your computer and use it in GitHub Desktop.
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
upstream exampleservers {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
}
upstream sampleservers {
server 127.0.0.1:8002;
server 127.0.0.1:8003;
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
keepalive_timeout 65;
proxy_read_timeout 200;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
proxy_next_upstream error;
server {
listen 80;
server_name example.com www.example.com;
client_max_body_size 50M;
location ^~ /static/ {
root /var/www;
if ($query_string) {
expires max;
}
}
location = /favicon.ico {
rewrite (.*) /static/favicon.ico;
}
location = /robots.txt {
rewrite (.*) /static/robots.txt;
}
location = /humans.txt {
rewrite (.*) /static/humans.txt;
}
location = /sitemaps.xml {
rewrite (.*) /static/sitemaps.xml;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://exampleservers;
}
}
server {
listen 80;
server_name sample.com www.sample.com;
client_max_body_size 50M;
location ^~ /static/ {
root /var/www;
if ($query_string) {
expires max;
}
}
location = /favicon.ico {
rewrite (.*) /static/favicon.ico;
}
location = /robots.txt {
rewrite (.*) /static/robots.txt;
}
location = /humans.txt {
rewrite (.*) /static/humans.txt;
}
location = /sitemaps.xml {
rewrite (.*) /static/sitemaps.xml;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://sampleservers;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment