News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Slawek's Blog:
Efficient file serving in PHP application with nginx
March 25, 2011 @ 12:34:34

In a quick new post to his blog today Slawek looks at a method he's come up with to more efficiently serve up files in a PHP application using the nginx web server.

Sometimes we need to serve files directly from application, especially when file access is restricted by account permissions. Using readfile() to achieve this can successfully kill our web server - even without huge load. To avoid performance problems we can use nginx X-Accel-Redirect feature, and serve files from application through nginx server.

He sets up an example situation - serving up gallery images for a basic site - and shows how to configure the nginx server with the "/gallery" directory and the PHP code you'll need to push the "X-Accel-Redirect" header along with the contents of the image.

0 comments voice your opinion now!
nginx application gallery image file serving


blog comments powered by Disqus

Similar Posts

Thomas Larsson\'s Blog: Asynchronous file upload with AJAX progress bar in PHP

Benjamin Eberlei's Blog: Benchmark and Optimize Zend Framework Performance

PHPRiot.com: Practical Web 2.0 Applications with PHP by Quentin Zervaas Released

Chris Hartjes' Blog: Where Are The Good Development Tools For PHP, Part II

Fabien Potencier: Packing a Symfony full-stack Framework Application in one File - Bootstrapping


Community Events





Don't see your event here?
Let us know!


api zendserver tips code community deployment bugfix podcast interview list threedevsandamaybe series release symfony language framework introduction laravel development conference

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework