Created
August 3, 2016 08:05
-
-
Save vamdt/fd3e95d33dadbfde77fe954bbcb5ad55 to your computer and use it in GitHub Desktop.
nginx proxy cache configuration
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
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Accept-Encoding 'gzip'; | |
client_max_body_size 100m; | |
client_body_buffer_size 256k; | |
proxy_connect_timeout 60; | |
proxy_send_timeout 60; | |
proxy_read_timeout 60; | |
proxy_buffer_size 512k; | |
proxy_buffers 8 512k; | |
proxy_busy_buffers_size 512k; | |
proxy_temp_file_write_size 512k;index index.html; |
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 website { | |
server 192.168.1.100; | |
server 192.168.1.101; | |
} | |
proxy_cache_path /path/to/cache/dir levels=1:2 keys_zone=website:100m inactive=10d max_size=3g; | |
server { | |
listen 80; | |
server_name website.example.com; | |
index index.html; | |
location / { | |
proxy_cache apiproxy; | |
proxy_ignore_headers Expires Cache-Control; | |
proxy_cache_valid 200 302 304 10d; | |
proxy_cache_key $host$uri$is_args$args; | |
include proxy.conf; | |
proxy_pass http://website; | |
expires 10d; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment