Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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.

CDN Server

The CDN server code can be found in the folder /PF.Site/Apps/PHPfox_CDN/server/

This folder can be moved to any server you wish as long as it has public HTTP access. The first thing we need to do is 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

<?php

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

The first constant, CDN_FOLDER is the path to place the uploaded files. You can change this and if you do, make sure to create a folder for that location.

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

AdminCP Settings

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

Once you have reached the app, click on NEW SERVER 

You will get a popup with 3 text input fields. The first is Upload URL. This is the full HTTP path to where the contents of the  /PF.Site/Apps/PHPfox_CDN/server/ is located. So if your phpFox site is located in your root directory the value for this would be http://localhost/PF.Site/Apps/PHPfox_CDN/server/

The next is View URL. This is the URL to the view folder, which by default is file/. The value for this would then be http://localhost/PF.Site/Apps/PHPfox_CDN/server/file/

The final setting is Secret Key. This is the same value as the CDN_KEY you created earlier. Hit Submit and you will have added your first CDN server.

Enable CDN

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

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

 

  • No labels