Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why thin behind nginx?

Deploying my first web app. I have been using thin, it's simple and easy. All I need is a config file.

But a lot of people use nginx and place a couple thin instance behind that. Why? Why not just use thin alone? And why use nginx rather than placing 3 thin instances behind a single thin instance? Thanks

like image 202
0xSina Avatar asked Mar 18 '13 04:03

0xSina


1 Answers

Scalability is the main reason. While Thin can do SSL, serve static files, and handle large responses to slow clients, Nginx is better at all of them for any given CPU and memory footprint. Even better, Nginx can do all that transparently so that the app doesn't have implement anything to benefit. It's also a decent load balancer.

Once your app scales beyond one machine, you will need something like Nginx anyway, and there is no harm in implementing it from the start. Even if your app doesn't need to scale, there are other reasons for using Nginx --- especially if you're running more than one web app on the same machine, or if the app is modular.

like image 124
Catnapper Avatar answered Oct 11 '22 17:10

Catnapper