Skip to content

Instantly share code, notes, and snippets.

@kareypowell
Last active December 14, 2015 18:29
Show Gist options
  • Save kareypowell/5130179 to your computer and use it in GitHub Desktop.
Save kareypowell/5130179 to your computer and use it in GitHub Desktop.
Nginx.conf lean configurations
# Checkout the Slicehost article for a minute nginx.conf, and the H5BP config for 'docs'
# http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-nginx-from-source-layout
# https://github.com/h5bp/server-configs/blob/master/nginx/nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 8000;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay off;
types_hash_max_size 2048;
server_tokens off;
include /opt/nginx/conf/mime.types;
default_type application/octet-stream;
# Seconds
keepalive_timeout 20;
##
# Logging Settings
##
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_min_length 512;
gzip_buffers 4 8k;
gzip_proxied any;
# text/html is always compressed by HttpGzipModule
gzip_types text/css text/plain text/x-component application/javascript application/json application/xml application/xhtml+xml application/x-font-ttf application/x-font-opentype application/vnd.ms-fontobject image/svg+xml image/x-icon;
# No gzip support for > IE6
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
##
# nginx-passenger config
##
passenger_root /home/deployer/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/passenger-3.0.19;
passenger_ruby /home/deployer/.rbenv/versions/1.9.3-p392/bin/ruby;
##
# Virtual Host Configs
##
include /opt/nginx/sites-enabled/*;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment