# Caching objects served from PHP

**URL:** <https://www.ruby-forum.com/t/caching-objects-served-from-php/210539>\
**Category:** NGINX\
**Created:** [August 10, 2011, 4:29pm UTC](https://www.ruby-forum.com/t/caching-objects-served-from-php/210539 "2011-08-10T16:29:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [August 10, 2011, 4:29pm UTC](https://www.ruby-forum.com/t/caching-objects-served-from-php/210539/1 "2011-08-10T16:29:50Z")

</div>

I have a server set up with nginx and PHP-FPM, running a framework that  
essentially sends all requests for content to PHP, which then serves it  
based on ACL rules. This includes images and other static content.

What I am trying to figure out is how I can get nginx to cache such  
objects to avoid the call to PHP for identical data, ie. a static image  
that hasn’t changed.

Since all these calls are essentially dynamic, and often the image  
objects won’t have easily identifiable extensions, I’m not sure how I  
might go about caching them.

I could put Varnish in front of nginx and have it do the caching but  
that would not allow caching of HTTPS traffic.

Suggestions welcome!

Posted at Nginx Forum:

> **[Caching objects served from PHP](https://forum.nginx.org/read.php?2,213634,213634#msg-213634)**
>
> I have a server set up with nginx and PHP-FPM, running a framework that essentially sends all requests for content to PHP, which then serves it based on ACL rules. This includes images and other static content. What I am trying to figure out is how I...

---

<div class="post-metadata">

**Author:** ![jwilson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@jwilson](https://www.ruby-forum.com/u/jwilson)\
**Post date:** [August 10, 2011, 7:40pm UTC](https://www.ruby-forum.com/t/caching-objects-served-from-php/210539/2 "2011-08-10T19:40:35Z")

</div>

Check out fastcgi\_cache:

[http://wiki.nginx.org/HttpFcgiModule#fastcgi\_cache](http://wiki.nginx.org/HttpFcgiModule#fastcgi_cache)

–  
Brian A.
