mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-07 04:09:17 +02:00
feat:#11 added caching for /api/modules
This commit is contained in:
@@ -1,57 +1,72 @@
|
|||||||
#user nobody;
|
|
||||||
worker_processes 1;
|
worker_processes 1;
|
||||||
|
|
||||||
#error_log logs/error.log;
|
error_log /var/log/nginx/error.log;
|
||||||
#error_log logs/error.log notice;
|
pid /var/run/nginx.pid;
|
||||||
#error_log logs/error.log info;
|
|
||||||
|
|
||||||
#pid logs/nginx.pid;
|
|
||||||
|
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
http {
|
http {
|
||||||
include mime.types;
|
include mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
||||||
# '$status $body_bytes_sent "$http_referer" '
|
|
||||||
# '"$http_user_agent" "$http_x_forwarded_for"';
|
|
||||||
|
|
||||||
access_log /var/log/nginx/proxy_access.log;
|
access_log /var/log/nginx/proxy_access.log;
|
||||||
error_log /var/log/nginx/proxy_error.log;
|
error_log /var/log/nginx/proxy_error.log;
|
||||||
|
|
||||||
sendfile on;
|
sendfile on;
|
||||||
#tcp_nopush on;
|
|
||||||
|
|
||||||
#keepalive_timeout 0;
|
|
||||||
keepalive_timeout 180s;
|
keepalive_timeout 180s;
|
||||||
send_timeout 180s;
|
send_timeout 180s;
|
||||||
|
|
||||||
#gzip on;
|
map $request_method $cache_bypass {
|
||||||
|
default 0;
|
||||||
|
POST 1;
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
proxy_cache_path /dev/shm levels=1:2 keys_zone=mcache:16m inactive=600s max_size=512m;
|
||||||
listen 80;
|
proxy_cache_methods GET HEAD;
|
||||||
server_name frontend;
|
proxy_cache_min_uses 1;
|
||||||
|
proxy_cache_key "$request_method$host$request_uri";
|
||||||
|
proxy_cache_use_stale timeout updating;
|
||||||
|
proxy_ignore_headers Cache-Control Expires Set-Cookie;
|
||||||
|
|
||||||
location /api {
|
server {
|
||||||
proxy_pass http://htwkalender-backend:8090;
|
listen 80;
|
||||||
client_max_body_size 20m;
|
server_name frontend;
|
||||||
proxy_connect_timeout 600s;
|
|
||||||
proxy_read_timeout 600s;
|
|
||||||
proxy_send_timeout 600s;
|
|
||||||
send_timeout 600s;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /_ {
|
location /api {
|
||||||
proxy_pass http://htwkalender-backend:8090;
|
proxy_pass http://htwkalender-backend:8090;
|
||||||
}
|
client_max_body_size 20m;
|
||||||
|
proxy_connect_timeout 600s;
|
||||||
|
proxy_read_timeout 600s;
|
||||||
|
proxy_send_timeout 600s;
|
||||||
|
send_timeout 600s;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
# Cache only specific URI
|
||||||
proxy_pass http://htwkalender-frontend:8000;
|
location /api/modules {
|
||||||
}
|
proxy_pass http://htwkalender-backend:8090;
|
||||||
}
|
client_max_body_size 20m;
|
||||||
|
proxy_connect_timeout 600s;
|
||||||
|
proxy_read_timeout 600s;
|
||||||
|
proxy_send_timeout 600s;
|
||||||
|
send_timeout 600s;
|
||||||
|
proxy_cache_bypass 0;
|
||||||
|
proxy_no_cache 0;
|
||||||
|
proxy_cache mcache; # mcache=RAM
|
||||||
|
proxy_cache_valid 200 301 302 30m;
|
||||||
|
proxy_cache_valid 403 404 5m;
|
||||||
|
proxy_cache_lock on;
|
||||||
|
proxy_cache_use_stale timeout updating;
|
||||||
|
add_header X-Proxy-Cache $upstream_cache_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /_ {
|
||||||
|
proxy_pass http://htwkalender-backend:8090;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://htwkalender-frontend:8000;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user