Last active
December 16, 2015 14:19
-
-
Save zaiste/5447677 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
upstream APP { | |
server unix:/tmp/APP.unicorn.sock.0 fail_timeout=0; | |
server unix:/tmp/APP.unicorn.sock.1 fail_timeout=0; | |
} | |
server { | |
listen 80 default; | |
server_name DOMAIN; | |
root /home/USER/apps/APP/current/public; | |
# try static files first, if fails, go to @app | |
try_files $uri/index.html $uri @app; | |
location @app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://APP; | |
} | |
location ~ ^/assets/ { | |
gzip_static on; | |
expires 1y; | |
add_header Cache-Control public; | |
add_header ETag ""; | |
} | |
# no favicon.ico requests in access log | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
# no robots.txt requests in access log | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
error_page 500 502 503 504 /500.html; | |
client_max_body_size 4G; | |
keepalive_timeout 10; | |
} |
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-data; | |
worker_processes 4; | |
pid /run/nginx.pid; | |
timer_resolution 400ms; | |
worker_rlimit_nofile 8192; | |
events { | |
use epoll; | |
worker_connections 8192; | |
} | |
http { | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
keepalive_timeout 65; | |
types_hash_max_size 2048; | |
server_tokens off; | |
# server_names_hash_bucket_size 64; | |
server_name_in_redirect off; | |
client_body_timeout 10; | |
client_header_timeout 10; | |
client_header_buffer_size 128; | |
client_max_body_size 8m; | |
open_file_cache max=1000 inactive=20s; | |
open_file_cache_valid 30s; | |
open_file_cache_min_uses 2; | |
open_file_cache_errors on; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
# Gzip Settings | |
gzip on; | |
gzip_disable "msie6"; | |
# gzip_vary on; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_comp_level 3; | |
gzip_buffers 4 16k; | |
gzip_http_version 1.1; | |
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
# Proxy | |
# -- | |
# proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=cache:80m inactive=1d max_size=2500m; | |
# different cache for different request methods e.g. GET/POST | |
# proxy_cache_key "$scheme$request_method$host$request_uri"; | |
# proxy_cache cache; | |
proxy_connect_timeout 300; | |
proxy_read_timeout 120; | |
proxy_send_timeout 120; | |
proxy_buffer_size 32k; | |
proxy_buffers 4 32k; | |
proxy_busy_buffers_size 32k; | |
proxy_temp_file_write_size 32k; | |
# Virtual Host Configs | |
# -- | |
include /etc/nginx/conf.d/*.conf; | |
include /etc/nginx/sites-enabled/*; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment