mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 09:38:49 +02:00
feat:#11 added caching for /api/modules
This commit is contained in:
@ -1,57 +1,72 @@
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
#error_log logs/error.log info;
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
error_log /var/log/nginx/error.log;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
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;
|
||||
error_log /var/log/nginx/proxy_error.log;
|
||||
error_log /var/log/nginx/proxy_error.log;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 180s;
|
||||
send_timeout 180s;
|
||||
|
||||
#gzip on;
|
||||
map $request_method $cache_bypass {
|
||||
default 0;
|
||||
POST 1;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name frontend;
|
||||
proxy_cache_path /dev/shm levels=1:2 keys_zone=mcache:16m inactive=600s max_size=512m;
|
||||
proxy_cache_methods GET HEAD;
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name frontend;
|
||||
|
||||
location /_ {
|
||||
proxy_pass http://htwkalender-backend:8090;
|
||||
}
|
||||
location /api {
|
||||
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 / {
|
||||
proxy_pass http://htwkalender-frontend:8000;
|
||||
}
|
||||
}
|
||||
# Cache only specific URI
|
||||
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