Cloudfront CDN integration with Magento - magento

I have searched a lot but still didn't get the way to sync media, css and js data with Cloudfront CDN.
Please help and let me know how can I do this thing.
Thanks in advance!!

I have not worked a lot with Magento, but a straight approach can be scheduling a cron task in your management node to sync up your static files with a S3 bucket. S3cmd is your friend here.
Then simply set your Cloudfrount distribution's Origin to your S3 bucket and set the static resource URLs in Magento to use your Cloudfront endpoint.

Related

How to purge CDN cache programmatically for an item?

After integration of azure CDN in our site, we found that the cache is not purged while replacing the file. This is happening only for PDF file type. We want to purge the cache on replace of the file. Please help us if anyone has faced the similar issue and purged the CDN cache programmatically.
Thanks
S.Ray ,
You can use the below Rest API doc to purge content from Azure CDN:
https://learn.microsoft.com/en-us/rest/api/cdn/cdn/endpoints/purgecontent
In the request body, under contentPaths parameter, you can provide the path to the content to be purged. It can describe a file path or a wild card directory.
Thanks!

Analytics tracking wrong url - including base domain after /

I was checking Analytics stats for my Magento store and found a few weird URLs with dozens of hits. The URLs where like this:
/domain.com
/checkout/cart/domain.com
Now I don't understand why Analytics is tracking those URLs as I cannot replicate this from my Magento store. I checked all the links manually and also checked my server logs, but can't find a clue about what is happening.
I'm using Magento Community 1.6 on a Nginx server, with Redis caching set. I also use Cloudflare.
Any clues?
Thanks in advance!

Amazon S3 bucket images return 403 error

I've just inherited a rails site hosted on heroku using S3 for storage of images uploaded with the paperclip gem and suddenly most images are returning 403 errors. Looking at the bucket through the management console, I don't see the files listed even.
The images are uploaded through the ckeditor wysiwyg plugin, and it looks like they should be inside a folder named 'rich', but no such folder exists within the bucket. Not all files are missing (though some that were throwing a 403 are now showing up on the site correctly without me having done anything I can think of to change that), but none of them are listed in the management console.
I'm unfamiliar with S3 and not sure how to diagnose let alone resolve this issue. Any suggestions on steps I can do to figure out what the problem is would be appreciated, thanks.
Every time I've seen this error, it has been permissions:
Triple-check your AWS Access_key, Secret_key, and REGION
If you have any doubt about the keys, regenerate a new set to be sure you are using the correct keys.
If you end up changing any of them, remember to restart your server to re-read the values.

Magento: use subdomains as a CDN for media folder

We are planning to use subdomains ie.cdn1.example.com, cdn2.example.com to deliver product images.
How to configure Magento for this?
How to handle Magento cache folder which save auto-generated thumbnails as per template?
If you're using an origin pull CDN like AWS Cloudfront, you just fill in the information telling their system your web server name, they provide you with a server name (randomchars.cloudfront.net) on their end and then you use a CNAME record in your DNS to point their server name at your subdomain name like media.example.com.
Then your base media URL becomes http://media.example.com/media/ and everything's pretty much automatic from there.
Using origin pull gets rid of having to maintain a separate system to host your images and try to get Magento to upload to it, or figure out how to replicate Magento's media folder to it.

Migrating Wordpress Uploads To Amazon S3

I currently use a plugin on wordpress that creates a carbon copy of the uploads in a s3 bucket whenever a new picture is added. The problem is on the same site there are about 700 pictures uploaded before we started to use this plugin that aren't on s3 and we need to free up some space. The plugin doesn't copy these old pictures over.
Does any one know of a way to redirect all the image urls to the s3 bucket instead if we manually copy the files over? Could this be done with a htaccess in the uploads folder?
Thanks for your help I am very bad with redirects and things and need to improve.
Jozef
Using:
RedirectPermanent /wp-content/uploads http://xxxx.s3.amazonaws.com/wp-content/uploads
In your main .htaccess file should do the trick, note this will redirect all uploads (including potentially non-image uploads).
No need to install any plugin. I did it by mapping wp-content/uploads to S3 bucket using S3FS. Refer Moving wordpress uploads to Amazon s3 using S3FS
If you want to save space on your server, don't use use_cache option while mounting S3FS. Good luck!
try to use s3cmd
install it configure it by providing it access and secrate key of aws
then sync your upload folder or image folder with s3 bucket
and your done

Resources