listings / pawoo / img-p.bgme.bid
proxy_cache_path /tmp/nginx_mstdn_media levels=1:2 keys_zone=mastodon_media:100m max_size=1g inactive=24h;
server {
    if ($host = img-p.bgme.bid) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
        listen 80;
        listen [::]:80;
        server_name img-p.bgme.bid;
        return 301 https://img-p.bgme.bid$request_uri;
        access_log /dev/null;
        error_log /dev/null;
}
server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name img-p.bgme.bid;
        # access_log /var/log/nginx/mstdn-media-access.log;
        error_log /var/log/nginx/mstdn-media-error.log;
        # Add your certificate and HTTPS stuff here
        location / {
try_files $uri @proxy;
}
location @proxy {
                proxy_cache mastodon_media;
                proxy_cache_revalidate on;
                proxy_buffering on;
                proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
                proxy_cache_background_update on;
                proxy_cache_lock on;
                proxy_cache_valid 1d;
                proxy_cache_valid 404 1h;
                proxy_ignore_headers Cache-Control;
                add_header X-Cached $upstream_cache_status;
                proxy_pass https://img.pawoo.net;
        }
}