Created
February 28, 2018 05:46
-
-
Save udomsak/5dd340c3991467acc1df08c6884d87d1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 static-server1 { | |
server 127.0.0.1:8888; | |
} | |
# Simple static serv content | |
server { | |
listen 127.0.0.1:8888; | |
root /storage/cdn/cdn1.softsq.com; | |
autoindex on; | |
} | |
server { | |
listen 80 ; | |
server_name cdn1.softsq.com; | |
# return 301 https://$host$request_uri; | |
set $key $host$uri; | |
srcache_response_cache_control off; | |
srcache_store_no_store on; | |
srcache_store_no_cache on; | |
srcache_store_private on; | |
#add_header X-Cache-Status $upstream_cache_status; | |
set_escape_uri $escaped_key $key; | |
srcache_fetch_skip $skip_cache; | |
srcache_store_skip $skip_cache; | |
srcache_fetch GET /redis-fetch $key; | |
srcache_store PUT /redis-store key=$key; | |
more_set_headers 'X-Cache $srcache_fetch_status'; | |
more_set_headers 'X-Cache-2 $srcache_store_status'; | |
location / { | |
proxy_pass http://static-server1; | |
} | |
} | |
location /redis-fetch { | |
internal ; | |
set $redis_key $args; | |
redis_pass 127.0.0.1:6379; | |
} | |
location /redis-store { | |
internal ; | |
set_unescape_uri $key $arg_key ; | |
redis_query set $key $echo_request_body; | |
redis_query expire $key 6h; | |
redis_pass 127.0.0.1:6379; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment