robb84 Posted August 14, 2020 Share Posted August 14, 2020 (edited) Hi. I just enable the media server function and created my subdomain on Plesk (cdn1.mydomain.com) . Now the problem is to synchronize the "/img" folder with primary domain, with the cdn subdomain "/img" folder . If I import or add products to shop, images are stored in primary domain "/img" folder, and I have to manually copy files to cdn1.mydomain.com/img ... anyone facing this problem ? Thanks. Edited August 14, 2020 by Roberto 84 (see edit history) Link to comment Share on other sites More sharing options...
watou Posted August 19, 2020 Share Posted August 19, 2020 If you have the ability to use the rclone command, you could make a local cron job that repeatedly syncs from your web server's file system to your CDN. I'm currently investigating this as a viable option. See https://rclone.org/docs/ . Something like below. I've not tried it and I can't offer further help but good luck! #!/bin/bash rclone sync /var/www/example.com/public_html/img examplebucket:img rclone sync /var/www/example.com/public_html/modules examplebucket:modules rclone sync /var/www/example.com/public_html/themes examplebucket:themes Link to comment Share on other sites More sharing options...
robb84 Posted August 20, 2020 Author Share Posted August 20, 2020 Thanks for reply. I can use cron jobs. I was searching for a more elegant solution. Something like an automatic image/thumbs creation directly to subdomain destination when importing products and or modules install. I found another problem with URL rewrite (obviously it rewrite image names for main domain and not for cdn subdomain). Can it be solved with different .htaccess rules changes from main domain ? Thank you. Link to comment Share on other sites More sharing options...
watou Posted August 20, 2020 Share Posted August 20, 2020 I don't know the answer to your question about the URL rewrite issue, but it definitely sounds like a complication. This company called Sirv offers a CDN service and PrestaShop module for using it. I've started to study the module source code but you might find the service suits your needs? https://sirv.com/help/articles/prestashop-cdn/ Link to comment Share on other sites More sharing options...
Magic Toolbox Posted August 22, 2020 Share Posted August 22, 2020 As mentioned by @watou, you can try the Sirv CDN addon for PrestaShop. It's been optimised to sync images, JS, CSS and theme files from PrestaShop to Sirv. Sirv resizes the images, optimises and delivers them from its global CDN in next-gen formats, such as WebP. It also applies lazy loading and it minifies your JS & CSS files. Removing all this overhead from PrestaShop, your server can dedicated more resources to running PrestaShop. It can also delete the PrestaShop resized images, which you won't need any more - saving potentially a lot of storage space on your server and lowering your hosting costs. If your goal is to get the best possible performance and PageSpeed score, these are the best-practices which Sirv applies: Serve images in next-gen formats Use lazy-loading Optimize images Serve scaled images Use a Content Delivery Network (CDN) Leverage browser caching Minify CSS Minify JavaScript Minimize request size Enable compression Reduce DNS lookups Use cookie-free domains Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now