Skip to content

Instantly share code, notes, and snippets.

@d5
Created December 15, 2013 02:51
Show Gist options
  • Save d5/7968255 to your computer and use it in GitHub Desktop.
Save d5/7968255 to your computer and use it in GitHub Desktop.
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
# max_clients = worker_processes * worker_connections / 4
worker_connections 1024;
}
http {
#proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
#proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
gzip_vary on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;
upstream nodes {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
keepalive 64;
}
server {
listen 80;
# HTTPS settings
#listen 443 ssl;
#ssl_certificate /path/to/cert.pem;
#ssl_certificate_key /path/to/cert.key;
#ssl_protocols SSLv3 TLSv1;
#ssl_ciphers HIGH:!aNULL:!MD5;
server_name example.com www.exmple.com;
if($host = 'example.com') {
rewrite ^/(.*)$ http://www.example.com/$1 permanent;
}
error_page 502 /errors/502.html;
# settings for static assets
location ~ ^/(static/|robots.txt|humans.txt|favicon.ico) {
root /usr/local/node/public;
access_log off;
expires max;
}
location /errors {
internal;
alias /usr/local/silly_face_society/node/public/errors;
}
# proxy settings for backend node apps
location / {
proxy_pass http://nodes;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
#proxy_cache one;
#proxy_cache_key sfs$request_uri$scheme;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment