I have a rails 3.0 app, and it has a good amount of traffic, the app it's running through the combination of Nginx and Unicorn. The thing is that unicorn and it's workers consume a lot of resources, and because of the nature of my app, a lot of records are pulled from the database, then it's like serving almost static files generated with those database records
I was wondering if you can generate this kind of static files, cache them, serve them through nginx instead of the app through unicorn to use less resources and kind of reloading the cache after 1000 request
I'm beginning my research about that, I don't know a lot of server configuration, so I hope you guys have any advise for me, it would be great!
thanks!
I assume you mean How do I serve my static assets from nginx rather than Unicorn
I just solved this problem and here is a snippet of my
nginx.conf
I am using Rails 3.0.10 so you my need something like
^/assets/
instead. The~*
directive tells nginx to do a case in-sensitive reg-ex compare. Also you don't need to escape the backslashes as you would in other languages.Here is the Nginx documentation on that: http://wiki.nginx.org/HttpCoreModule#location