Skip to content

Instantly share code, notes, and snippets.

@tregoning
Created October 4, 2013 20:43
Show Gist options
  • Save tregoning/6832402 to your computer and use it in GitHub Desktop.
Save tregoning/6832402 to your computer and use it in GitHub Desktop.
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
charset utf-8;
index index.html index.htm;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
underscores_in_headers on;
#proxy_intercept_errors on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_comp_level 5;
gzip_vary on;
gzip_min_length 1400;
gzip_disable "msie6";
gzip_proxied any;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/xml+rss
application/vnd.ms-fontobject
application/x-javascript
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/xml
text/plain
text/javascript
text/x-component;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#server {
# listen 80;
# server_name www.example.com;
# return 301 $scheme://example.com$request_uri;
#}
upstream node_servers{
server 127.0.0.1:3000;
}
server {
listen 80 default_server deferred;
server_name localhost;
#error_page 404 /errors/404.html;
#error_page 500 501 502 503 504 505 /errors/50x.html;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ @nodejs;
}
location @nodejs {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://node_servers;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
}
# Include the component config parts for h5bp
#include conf/h5bp.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment