logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

howto_mediaproxy.md (1567B)


  1. # How to activate mediaproxy
  2. ## Explanation
  3. Without the `mediaproxy` function, Pleroma doesn't store any remote content like pictures, video etc. locally. So every time you open Pleroma, the content is loaded from the source server, from where the post is coming. This can result in slowly loading content or/and increased bandwidth usage on the source server.
  4. With the `mediaproxy` function you can use nginx to cache this content, so users can access it faster, because it's loaded from your server.
  5. ## Activate it
  6. * Edit your nginx config and add the following location:
  7. ```
  8. location /proxy {
  9. proxy_cache pleroma_media_cache;
  10. proxy_cache_lock on;
  11. proxy_pass http://localhost:4000;
  12. }
  13. ```
  14. Also add the following on top of the configuration, outside of the `server` block:
  15. ```
  16. proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g inactive=720m use_temp_path=off;
  17. ```
  18. If you came here from one of the installation guides, take a look at the example configuration `/installation/pleroma.nginx`, where this part is already included.
  19. * Append the following to your `prod.secret.exs` or `dev.secret.exs` (depends on which mode your instance is running):
  20. ```
  21. config :pleroma, :media_proxy,
  22. enabled: true,
  23. proxy_opts: [
  24. redirect_on_failure: true
  25. ]
  26. #base_url: "https://cache.pleroma.social"
  27. ```
  28. If you want to use a subdomain to serve the files, uncomment `base_url`, change the url and add a comma after `true` in the previous line.
  29. * Restart nginx and Pleroma