How to configure nginx to serve static contents from RAM?
- by Vijayendra Tripathi
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.