0

We are looking forward to offload assets from our website (60GB onto a 8TB/mo accessed website), to a separate webserver that will be there only for serving images from a separate domain.

I know that I can apply filters to match /wp-content/uploads and rewrite these URLs in order to point at the new domain, but I have no way to have the Media Library Uploader to upload files straight to the new server.

Of course, I can provide SSH/Rsync and relative access between two servers. There are a few plugins that do the same for Buckets like AWS/Google Cloud and they do take care of removing the file locally, but the comparison of the services' price between an owned machine and these services showed big difference, so we ended up in developing our own solution.

Can anyone advise on how I can have Media Uploader to work with a different host? I thought that this was already implemented using a defined constant in wp-config, but thats untrue.

1

You should not remove the media from you server. Media is part of yout content and it makes no sense to have your content split over several servers. (from technical practical POV your idea will prevent any automated media transformation like new sizes from being done).

What you should do is to create your own "lite CDN" which is actually just a sort of caching proxy for the media related URLs.

(side note: you can rarely re-invent a wheel for your car which is cheaper than a wheel you can buy in a shop)

  • Im wondering why plugins like 'WP Offload Media (formerly WP Offload S3)' allow people to delete data from the media library. Actually, sizing is being done during image uploading - isnt it ? Can you please describe the 'lite CDN' scenario that you have in mind? Do you mean a single storage that rsyncs the media library? – John Greco Jan 10 at 7:44
  • they do it because people think it is somehow needed/good. Mostly image resizing is done on upload, but if you will need to edit an image or use something like the 'regenerate thumbnails" plugin you are going to be out of luck, and then they are probably more edge case scenarios like limiting access to some of the content. – Mark Kaplun Jan 10 at 11:55
  • As for "lite CDN", you can just use a server and configure it with a caching proxy that translate the requests it get from something like static.example.com/image to example.com/wp-content/uploads/image, get the image from the origin server, stores it as a cache for future requests on the proxy, and 'returns" it as the reply. You can probably do such configuration with nginx, varnish and probably other tool. This way you skip the sync stage and you keep your images at the origin without serving it from it unless the proxy requests it – Mark Kaplun Jan 10 at 12:01
  • Thanks for the useful answers. I'll probably stick to solutions like external (same LAN) attached storage on the machine and filter URLs for parallel domain loading. – John Greco Jan 10 at 14:54
  • Oh if you can have things on the same LAN then you can just use NFS to connect to file storage, or whatever the young kids use to get network storage functionality today ;) – Mark Kaplun Jan 10 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.