Skip to content

Instantly share code, notes, and snippets.

@ppsreejith
Last active November 27, 2017 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppsreejith/23280152c057af167144ad18c8cccc92 to your computer and use it in GitHub Desktop.
Save ppsreejith/23280152c057af167144ad18c8cccc92 to your computer and use it in GitHub Desktop.
nginx conf for s3 proxy
worker_processes auto;
pid /run/nginx.pid;
daemon off;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
include /usr/local/nginx/conf/mime.types;
default_type image/jpeg;
access_log /dev/null;
error_log /dev/null;
gzip off;
proxy_cache_lock on;
proxy_cache_lock_timeout 60s;
proxy_cache_path /data/cache levels=1:2 keys_zone=s3cache:500m max_size=18g inactive=24000h;
server {
listen 8000;
location / {
proxy_buffers 8 4m;
proxy_buffer_size 2k;
proxy_pass https://s3.ap-south-1.amazonaws.com;
proxy_cache s3cache;
proxy_cache_valid 200 302 24000h;
proxy_cache_use_stale http_500 http_502 http_503 http_504;
add_header Cache-Control "max-age=31556926";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment