mastodon scaleway设置

回复
头像
admin
网站管理员
帖子: 82
注册时间: 2016-12-31, 08:39

mastodon scaleway设置

帖子 admin » 2023-02-04, 09:37

代码: 全选

S3_ENABLED=true
S3_BUCKET= BUCKET名称
AWS_ACCESS_KEY_ID= 你的ACCESS_KEY
AWS_SECRET_ACCESS_KEY=你的 ECRET_ACCESS_KEY
S3_PROTOCOL=https
S3_ALIAS_HOST=你的媒体域名
S3_HOSTNAME=
S3_ENDPOINT=https://s3.nl-ams.scw.cloud #你的区域
nginx.conf

代码: 全选

proxy_cache_path   /tmp/nginx-cache-instance-media levels=1:2 keys_zone=s3_cache:10m max_size=10g
                    inactive=48h use_temp_path=off;

server {
    listen 80;
    listen [::]:80;
    server_name media.metalhead.club;

    access_log off;
    error_log /var/log/nginx/media.metalhead.club-error.log;

    root /home/mastodon/live/public/system;

    set $s3_backend 'https://instance-media.s3.fr-par.scw.cloud';

    keepalive_timeout 30;

    location = / {
        index index.html;
    }

    location / {
        try_files $uri @s3;
    }
    
    location @s3 {
        limit_except GET {
                deny all;
        }

        resolver 9.9.9.9;
        proxy_set_header Host 'instance-media.s3.fr-par.scw.cloud';
        proxy_set_header Connection '';
        proxy_set_header Authorization '';
        proxy_hide_header Set-Cookie;
        proxy_hide_header 'Access-Control-Allow-Origin';
        proxy_hide_header 'Access-Control-Allow-Methods';
        proxy_hide_header 'Access-Control-Allow-Headers';
        proxy_hide_header x-amz-id-2;
        proxy_hide_header x-amz-request-id;
        proxy_hide_header x-amz-meta-server-side-encryption;
        proxy_hide_header x-amz-server-side-encryption;
        proxy_hide_header x-amz-bucket-region;
        proxy_hide_header x-amzn-requestid;
        proxy_ignore_headers Set-Cookie;
        proxy_pass $s3_backend$uri;
        proxy_intercept_errors off;

        proxy_cache s3_cache;
        proxy_cache_valid 200 304 48h;
        proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
        proxy_cache_lock on;
        proxy_cache_revalidate on;

        expires 1y;
        add_header Cache-Control public;
        add_header 'Access-Control-Allow-Origin' '*';
        add_header X-Cache-Status $upstream_cache_status;
    }
}

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 0 访客