Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

This tutorial requires at least an intermediate level of knowledge. If you are not at that level or cannot get this to work, please seek assistance from experts.

Requires: phpfox 4.3+

You can setup your own CDN servers with phpFox. It can be hosted on the same HTTP server as your site, however, it's best to keep it separate.

 

In this documentation, we will guide you on how to set it up on the same HTTP server.

 

All examples in this tutorial use below information:

 

 

Step 1: Setting up CDN server

The source code for CDN server can be found in the folder /PF.Site/Apps/core-cdn/server/.
This folder can be moved to anywhere in on your server but make sure that it has public HTTP access. For example, in this tutorial, we will move it to the root folder of the site and rename to cdn CDN:

 

/var/www/html/cdn

Now, open it, you can see files and folders like this:

 

Next, we need to update something in there:

  • Rename the file phpfox-cdn-setting.php.new to phpfox-cdn-setting.php.
  • Open the file phpfox-cdn-setting.php. You will find the following constants.
Code Block
php
php

<?php

define('CDN_FOLDER', './file/');
define('CDN_KEY', '');

...

In this example, we will update the file:

Code Block
php
php

<?php

define('CDN_FOLDER', './file/');
define('CDN_KEY', 'phpFox2017');

...

With this example, it will be:

 

http://www.example.phpfox.com/cdn

The next is View URL. This is the URL to the view folder, which by default is file/. The value for this example would then be:

 

 

http://www.example.phpfox.com/cdn/file/

The final setting is Secret Key. This is the same value as the CDN_KEY you updated earlier (phpFox2017 with this example).

 

Hit Submit and you will have added your first CDN server.

...

There are no limits on how many servers you can add and extending extend the server code is possible to spread the uploaded files across many locations.