Created
February 26, 2014 03:43
-
-
Save notsobad/9223145 to your computer and use it in GitHub Desktop.
Proxy cache sample.
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_cache_path /data/proxy_cache levels=1:2 keys_zone=ui-cache:10m max_size=2048m; | |
server { | |
# api proxy | |
listen 80; | |
# Force cache post data for 3 days. | |
location /xxxx.php { | |
proxy_cache_key "$scheme://$host$request_uri|$request_body"; | |
proxy_cache_valid 200 3d; | |
proxy_cache ui-cache; | |
proxy_cache_methods POST; | |
proxy_pass http://127.0.0.1:8200/xxxx.php; | |
} | |
# Cache url with basic auth. | |
location / { | |
proxy_set_header Host "notsobad.me"; | |
proxy_cache_key "$scheme://$host$request_uri|$http_authorization"; | |
proxy_cache ui-cache; | |
proxy_pass http://10.10.10.10/; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment