-
-
Save billturner/521434 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www www; | |
worker_processes 5; | |
error_log logs/error.log; | |
pid logs/nginx.pid; | |
worker_rlimit_nofile 8192; | |
events { | |
worker_connections 4096; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
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 logs/access.log main; | |
keepalive_timeout 65; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_comp_level 2; | |
gzip_min_length 1100; | |
gzip_buffers 4 8k; | |
gzip_proxied any; | |
gzip_types text/html text/plain text/xml application/xml application/xml+rss text/css application/x-javascript text/javascript application/javascript application/json; | |
gzip_static on; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_disable "MSIE [1-6]\."; | |
gzip_vary on; | |
server { | |
listen 80 default deferred; | |
server_name example.com; | |
expires 1M; | |
error_page 404 /404.html; | |
root /sites/example.com/public; | |
#static assets | |
location ~* ^.+\.(manifest)$ { | |
expires 0S; | |
root /sites/example.com/public; | |
access_log logs/static.log; | |
} | |
# allow access from all domains for webfonts | |
location ~* ^.+\.(ttf|otf|eot|woff|font.css)$ { | |
# only set expires max IFF the file is a static file and exists | |
if (-f $request_filename) { | |
expires max; | |
root /sites/example.com/public; | |
add_header Access-Control-Allow-Origin "*" | |
access_log logs/static.log; | |
} | |
} | |
location ~* ^.+\.(ico|ogg|ogv|svg|svgz|mp4|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { | |
# only set expires max IFF the file is a static file and exists | |
if (-f $request_filename) { | |
expires max; | |
root /sites/example.com/public; | |
access_log logs/static.log; | |
} | |
} | |
} | |
server { | |
server_name www.example.com; | |
rewrite ^(.*) http://example.com$1 permanent; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment