Created
January 11, 2015 20:13
-
-
Save korczis/2702e00d0373ce50c899 to your computer and use it in GitHub Desktop.
Nginx lethe.it conf - cache, sockets, gzip
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
roxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=cache:8m max_size=3000m inactive=600m; | |
proxy_temp_path /var/tmp; | |
log_format rt_cache '$remote_addr - $upstream_cache_status [$time_local] ' | |
'"$request" $status $body_bytes_sent ' | |
'"$http_referer" "$http_user_agent"'; | |
server { | |
listen 80; | |
server_name lethe.it; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
access_log /var/log/nginx/lethe-it.access.log rt_cache; | |
listen 443 ssl; | |
server_name lethe.it; | |
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; | |
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; | |
# enable session resumption to improve https performance | |
# http://vincent.bernat.im/en/blog/2011-ssl-session-reuse-rfc5077.html | |
ssl_session_cache shared:SSL:50m; | |
ssl_session_timeout 5m; | |
# 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; | |
location / { | |
proxy_pass http://localhost:3000; | |
proxy_redirect off; | |
proxy_http_version 1.1; | |
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 X-NginX-Proxy true; | |
proxy_set_header Host $host; | |
proxy_cache cache; | |
# proxy_ignore_headers "Cache-Control" "Expires"; | |
# proxy_cache_key $scheme$proxy_host$uri$is_args$args; | |
# proxy_cache_key "$scheme://$host$request_uri"; | |
proxy_cache_valid 200 302 1d; | |
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; | |
# proxy_cache_bypass $http_secret_header; | |
# add_header X-Cache-Status $upstream_cache_status; | |
add_header Cache-Control "public"; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_cache_bypass $http_upgrade; | |
} | |
location /public { | |
root /www/lethe.it/public; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment