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 set up your own CDN storage servers with phpFox. It can be hosted on the same HTTP web 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 web server.

 

All examples in this tutorial use below information:

 

 

Step 1: Setting up

...

Storage servers

The source code for CDN a storage server can be found in the folder /PF.Site/Apps/core-cdn/server/.
This folder can be moved to anywhere 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 storage:

 

/var/www/html/cdnstorage

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

 Image Added

Image Removed

Next, we need to update something in there:

...

Code Block
php
php
<?php

define('CDNSTORAGE_FOLDER', './file/');
define('CDNSTORAGE_KEY', '');

The first constant, CDNSTORAGE_FOLDER is the path to store the user uploaded files. You can change CDNthe STORAGE_FOLDER value value, but you must be sure about the existence of the new folder.

The next constant is CDNSTORAGE_KEY . This is a unique key you create and will be used when you assign this server to the App in your phpFox AdminCP. Remember this key for the next step.

In this example, we will update the file:

Code Block
php
php
<?php

define('CDNSTORAGE_FOLDER', './file/');
define('CDNSTORAGE_KEY', 'phpFox2017');

Step 2: AdminCP Configurations

Now that we have our CDN Storage server ready. Log into your AdminCP and head on over to Apps >> phpFox CDNStorage.

Once you have reached the app, click on NEW SERVER

...

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

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/cdnstorage/file/

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

 Image Added

Image Removed

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

Step 3: Enable

...

Storage

Now that we have updated the CDN Storage server and assigned it to the App we need to enable the CDN extended Storage feature. On the same page where you manage your CDN Storage servers, you will find a link Settings. Click on that and then click Yes to enable the service.

...