How to configure nginx to serve static contents from RAM?

Posted by Vijayendra Tripathi on Server Fault See other posts from Server Fault or by Vijayendra Tripathi
Published on 2012-06-10T19:06:57Z Indexed on 2012/06/10 22:42 UTC
Read the original article Hit count: 313

Filed under:
|
|

I want to set up nginx as my web server. I want to have image files cached in the memory (RAM) rather then disk. I am serving a small page and want few images always served from RAM. I dont wish to use varnish (or any other such tools) for this as I believe nginx has a capability to cache contents into RAM. I am not sure as how may I configure nginx for this? I did try few combinations but they didn't work. nginx uses disk all the time to get images.

For example, when I tried apache benchmark to test with following command -

ab -c 500 -n 1000 http://localhost/banner.jpg

I get following error -

socket: Too many open files (24) 

I guess this means nginx is trying to open to many files simultaneously from the disk and OS is not allowing this operation. Can anyone please suggest me a correct configuration?

Thanks for considering this message.

© Server Fault or respective owner

Related posts about nginx

Related posts about cache