http { # limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m; # limit_req_zone $http_x_forwarded_for zone=req_limit_per_ip:10m rate=10r/s; proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=thumbnail_cache:500m max_size=5g inactive=2h use_temp_path=off; map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { # limit_conn conn_limit_per_ip 10; # proxy_connect_timeout10s; # proxy_send_timeout 10s; # proxy_read_timeout 10s; # limit_req zone=req_limit_per_ip burst=5 nodelay; listen 80; # server_name example.org; # DO KOREKTY access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; charset utf-8; # Health check location location /healthcheck { access_log off; # Optional: Disable logging for health check requests return 200 'Nginx is healthy'; # Always return 200 OK for health check add_header Content-Type text/plain; # Set content type } location ~ ^/api/files/[^/]+/thumbnail/(.*) { # Rewrite first rewrite ^/api(/.*)$ $1 break; # Enable caching proxy_cache thumbnail_cache; proxy_cache_valid 200 30d; proxy_cache_valid 404 1m; proxy_cache_use_stale error timeout updating; # Use the rewritten URI for the key proxy_cache_key "$scheme$request_method$host$uri?size=$arg_size"; # Add caching info header add_header X-Cache-Status $upstream_cache_status always; # Proxy settings proxy_pass http://backend:8000; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } location /api/ { proxy_pass http://backend:8000/; # passes unchanged path to backend proxy_set_header Host $host; # sets http host header to the name of the original caller - so it changes nothing proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-Protocol $scheme; } location / { root /var/www/idrive/frontend; try_files $uri $uri/ /index.html; # gzip_static on; # Let Nginx auto-select .gz if client supports it include /etc/nginx/mime.types; default_type application/octet-stream; } } } #a tu to co ma byc? events {}