Skip to content

Speed up your page

YouPHPTube edited this page Jun 26, 2019 · 34 revisions

I will try to explain here the magic we use to try to make our pages load faster and handle thousands of requests.

Enabling these options will certainly make your site load faster, but the content presented may not be the most recent.

for example, you just upload a video, and you can already see the video in the video manager, but it still does not appear on the main page. Do not worry, YouPHPTube is on the back updating it and will display for you soon, we will prioritize the quick presentation, even if this is not the latest content.

Enable Cache Plugin

Websites are generally viewed hundreds, thousands, or sometimes even millions of times per month. Normally, each time a browser requests a web page, the server has to do a bunch of complex (and time-consuming) calculations. But if you enable this plugin instead process every request you will serve static pages that expire in a specific amount of time, and then this page will be recreated.

Enable a CDN for your videos

The purpose of this is to minimize the distance between your visitors and your video files, a CDN stores a cached version of your content in multiple geographic locations.

To use a CDN please read this

https://github.com/DanielnetoDotCom/YouPHPTube/wiki/Using-CDN-for-Videos-Only

Disable midias access Security

We use the apache xsend file to control every file access on our site, but for that, we have to check every time if your user has the proper right to access it. To avoid PHP to be querying on each file access (JS, CSS, Images, and videos) Disable the xsendfile.

To do this edit your .htaccess file and comment RewriteRule regarding xsendfile, so after the comment, you should have a configuration just like below

# It must be before image not found
<IfModule mod_xsendfile.c>
   #RewriteRule    ^videos/([A-Za-z0-9-_.]+)$ view/xsendfile.php?file=$1    [QSA]
</IfModule>  

But be aware, if you disable the xsendfile your plugin SecureVideosDirectory will be useless.

Clone this wiki locally