Web Servers

We successfully deployed and served the first website with NGINX, but we still don’t know why things work out of the box. We’ll fix that by going through the default NGINX configuration in detail. We’ll see how static sites are served and learn about various directives we can use in our configuration too. Once we understand that, we’ll move on and learn how to use NGINX as a proxy server.In most configurations today, Ruby and Python application servers sit behind a reverse proxy server. The reverse proxy handles TLS encryption, serves static assets, or protects the application against slow clients. The reason for that is twofold. Servers like NGINX are far more optimized to do these tasks efficiently. And application servers can stay lighter, focusing on serving the application.

Table of Contents

Kinds of Web Servers

Running a Web Server

NGINX Configuration

Static Websites

Nice URLs

Configuring Redirects

Separating Multi-Site Configurations

Reverse Proxy

Using TCP Sockets
Using UNIX Sockets
Server References

Restricting Access


Log Rotation With logrotate


Buy for $50
Rated 36x five stars
Gumroad (as of Aug 3, 2023)
I am using some scripts I downloaded from Josef Strzibny's book that are setting up Ruby on Rails deployment and automatically installing a PostgreSQL server. I am also using Dokku, but I like the idea of controlling what is happening on the server.
Lucian Ghinda, Senior Ruby Developer