[odrs-web] nginx: Enable proxy_cache for API responses
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [odrs-web] nginx: Enable proxy_cache for API responses
- Date: Thu, 28 Apr 2022 07:43:59 +0000 (UTC)
commit e1aaf303465a1df803fe884322c2a9458a44d4af
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Thu Apr 28 09:43:03 2022 +0200
nginx: Enable proxy_cache for API responses
nginx.conf | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/nginx.conf b/nginx.conf
index 001d6ae..f00390c 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -33,9 +33,12 @@ http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
+ '"$http_user_agent" "$http_x_forwarded_for" $upstream_cache_status';
access_log /dev/stdout main;
+ proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=cache:10m max_size=1g
+ inactive=30d use_temp_path=off;
+
server {
listen 8000 default_server;
listen [::]:8000 default_server;
@@ -43,6 +46,12 @@ http {
error_log /dev/stderr;
location / {
+ proxy_cache cache;
+ proxy_cache_valid 200 15m;
+ proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
+ proxy_cache_lock on;
+ proxy_cache_revalidate on;
+
proxy_pass http://odrs:8080/;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]