7edda27537613a18530ee01ed44c5f7f53278118
[akkoma] / docs / administration / storing_remote_media.md
1 # Storing Remote Media
2
3 Pleroma does not store remote/federated media by default. The best way to achieve this is to change Nginx to keep its reverse proxy cache
4 forever and to activate the `MediaProxyWarmingPolicy` MRF policy in Pleroma which will automatically fetch all media through the proxy
5 as soon as the post is received by your instance.
6
7 ## Nginx
8
9 We should be using `proxy_store` here I think???
10
11 ```
12 location ~ ^/(media|proxy) {
13 proxy_cache pleroma_media_cache;
14 slice 1m;
15 proxy_cache_key $host$uri$is_args$args$slice_range;
16 proxy_set_header Range $slice_range;
17 proxy_http_version 1.1;
18 proxy_cache_valid 200 206 301 304 1h;
19 proxy_cache_lock on;
20 proxy_ignore_client_abort on;
21 proxy_buffering on;
22 chunked_transfer_encoding on;
23 proxy_ignore_headers Cache-Control;
24 proxy_hide_header Cache-Control;
25 proxy_pass http://127.0.0.1:4000;
26 }
27 ```
28
29 ## Pleroma
30
31 Add to your `prod.secret.exs`:
32
33 ```
34 config :pleroma, :instance,
35 rewrite_policy: [Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy]
36 ```