Created
October 25, 2019 03:58
-
-
Save xlbruce/3b820105ea1cb1b10566c9a453e61fcb to your computer and use it in GitHub Desktop.
Nginx cache
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
1 upstream apache { | |
2 server apache; | |
3 } | |
4 | |
5 map $args $cache_bypass { | |
6 default 0; | |
7 ~nocache 1; | |
8 } | |
9 | |
10 server { | |
11 listen 80 default_server; | |
12 server_name localhost; | |
13 | |
14 #charset koi8-r; | |
15 #access_log /var/log/nginx/host.access.log main; | |
16 | |
17 | |
18 location / { | |
19 add_header X-Cache $upstream_cache_status; | |
20 add_header X-cache-bypass $cache_bypass; | |
21 add_header X-args $args; | |
22 proxy_cache trips_cache; | |
23 proxy_cache_valid 200 2s; | |
24 proxy_cache_bypass $cache_bypass; | |
25 proxy_pass http://apache; | |
26 | |
27 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment