Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distinguishing between nginx and thin

This is a newbie question around nginx and thin in the rails environment. In reading/learning on rails I frequently hear about nginx and thin being a great combination for a rails site. In reading the descriptions of each, they both describe themselves as web servers, so I'm a little confused at what the combination brings to the table. If anyone could briefly describe what they are and how they complement each other I would be greatly appreciative.

Thanks!

like image 334
Chris Dellinger Avatar asked Sep 09 '10 14:09

Chris Dellinger


People also ask

Why NGINX is called reverse proxy?

Why is the Nginx webserver called a "reverse proxy"? "Reverse proxy" refers to a specific function that a specific Nginx instance can take on. Other Nginx instances can be ordinary web servers, or mail proxies or even load balancers (which often refers to "reverse proxy across multiple servers").

Is NGINX a web server or application server?

Nginx (Link resides outside IBM) is an open source web server that includes reverse proxy, load balancing, mail proxy, and HTTP cache capabilities. Commercial, supported versions of Nginx are also available, at Nginx, Inc.

Is NGINX a reverse proxy?

NGINX Plus and NGINX are the best-in-class reverse proxy and load balancing solutions used by high-traffic websites such as Dropbox, Netflix, and Zynga.

What is the advantage of using NGINX?

NGINX is one of the most popular web servers and reverse proxies available today. It offers high performance, almost infinite configurability, and is a commonly used component in modern stacks like Kubernetes.


1 Answers

A typical small application deployment will have Nginx(or Apache) and a handful of Thin(or Mongrel, Unicorn, etc) servers running all on one machine.

Nginx receives every request. It then serves and static files directly (css, js, images, cached stuff). If the request requires processing it then hands the request off to a rails process (Thin).

This way your (relatively) slow application servers are freed up from serving static files, and your web server is providing a sort of load balancing.

The benefit of Nginx/Thin over something like Apache/Mongrel is that Nginx/Thin can communicate directly via a unix socket, removing the overhead of communicating via the tcp/ip stack.

like image 133
Alan Peabody Avatar answered Sep 21 '22 15:09

Alan Peabody