January 23, 2023

How to move all assets to an object storage and serve via a CDN?

Back to Solutions

You can easily upload all static files to an object storage of your choice and service it via a CDN. Currently Premium URL Shortener fully integrates direct upload to an object storage such as AWS S3, Digitalocean Spaces and many others. 


Step 1 - Setup credentials

You can set up your account and credentials by following the guide for the respective object storage at https://gempixel.com/docs/premium-url-shortener#cdn 


Step 2 -  Sync existing uploaded contents

Once the setup is done, you can sync all uploaded files directly from the admin panel where you setup your credentials


Step 3 - Upload static assets files

While the sync feature uploads all files uploaded by users, it does not upload static assets. You will need to upload those manually. Login to your hosting control panel or FTP to your server. Go to /public/ folder and compress the "static" folder. Download and upload all files in the static folder to the object storage storage of your choice. Once that is done, go to the file config.php and you will see the following line: 

define("CDNASSETS", null);

Replace null by a the url to the static folder - make sure to add the static folder at the end e.g. https://mycdnendpoint/static

Example:

define("CDNASSETS", "https://mycdnendpoint/static");

Now all of your files will be served via the CDN. New uploaded files will be automatically uploaded to the object storage and served via the CDN.

Was this solution helpful?

Related Solutions

7-Day Website

Professional site, live in one week. Built to convert visitors into customers.

Your website. Live in 7 days or less. Starting at $999.

Enterprise Solutions

Complex requirements? We've built platforms handling 10M+ requests daily.

Let's architect something your competitors can't copy.

GemPixel