01Chapter 1: How a request reaches your applicationA web request usually passes through several layers before your application produces a response. Understanding this path makes configuration and troubleshooting much easier.2 min read
02Chapter 2: Embedded, FastCGI, and reverse-proxy modelsAssume you know basic Linux commands, file permissions, HTTP status codes, and how to edit a Debian or Ubuntu server. You should also have a small PHP or Python application to test. This chapter explains how Nginx passes a request to application code.2 min read
03Chapter 3: Nginx basics: server blocks, root, and locationsThis chapter assumes you know basic Linux commands and file permissions, can edit files on a Debian or Ubuntu server, and understand HTTP requests, responses, status codes, and headers. You should also have a small PHP or Python application available for later chapters.2 min read
04Chapter 4: Serving static files directly, sending the rest to the appAssume you know basic Linux permissions, HTTP status codes, and how to edit an Nginx configuration. You also need a PHP or Python application that already runs locally. This chapter focuses on deciding which requests Nginx can answer itself and which requests must reach the application.2 min read
05Chapter 5: Unix sockets or TCP ports between web server and appAssume you already understand basic Linux permissions, HTTP requests, Nginx configuration, and how to edit and restart services. This chapter focuses on the connection between Nginx and an application process after Nginx has received a request.2 min read
06Chapter 6: PHP-FPM: pools and worker processesAssume you know basic Linux permissions, systemd commands, HTTP status codes, and how Nginx sends PHP requests to FastCGI. PHP-FPM, or PHP FastCGI Process Manager, runs PHP code in separate processes so Nginx does not need to execute PHP itself.2 min read
07Chapter 7: Connecting Nginx to PHP-FPM with FastCGIAssume you know basic Linux commands, file permissions, HTTP status codes, and how to edit files on Debian or Ubuntu. You also need a PHP application stored on the server.2 min read
08Chapter 8: WSGI and ASGI: how Python apps talk to serversThis chapter assumes that you understand HTTP requests and responses, can use a Linux shell, and have basic Python knowledge. It also assumes that you can create a virtual environment and install packages with pip.2 min read
09Chapter 9: Running a Python app with GunicornThis chapter assumes that you know basic Linux commands, file permissions, HTTP requests, and Python virtual environments. You also need a small Python web application that exposes a WSGI callable. WSGI is a standard interface between a Python web application and an application server.2 min read
10Chapter 10: Putting Nginx in front of Gunicorn with proxy_passAssume you know basic Linux commands, file permissions, HTTP status codes, and how to manage services on Debian or Ubuntu. This chapter also assumes that your Python application works with WSGI and that Gunicorn can serve it.2 min read
11Chapter 11: Keeping the app running with systemdAssume you know basic Linux commands, file permissions, HTTP status codes, and how to run your PHP or Python application manually. This chapter uses a Python application served by Gunicorn. PHP-FPM follows the same service-management ideas, but its package usually provides the unit file for you.2 min read
12Chapter 12: Passing Host, client IP, and scheme to the appAssume you know basic HTTP headers, Nginx locations, and how to run an application server such as Gunicorn. This chapter focuses on a reverse-proxy deployment where Nginx accepts the client connection and forwards the request to your application.2 min read
13Chapter 13: Terminating HTTPS at the web serverAssume you understand HTTP requests, DNS, Linux permissions, and basic Nginx server blocks. You also need a domain name that points to your server. This chapter uses Nginx as the HTTPS endpoint and forwards application requests to a local Python server.2 min read
14Chapter 14: Service users, file permissions, and blocking hidden filesAssume you know basic Linux ownership, permissions, HTTP, and how Nginx forwards requests to PHP-FPM or Gunicorn. This chapter focuses on reducing the damage caused by a compromised application or a configuration mistake.2 min read
15Chapter 15: Reading logs and fixing 502, 403, and 404 errorsAssume you know basic Linux commands, file permissions, HTTP status codes, and the Nginx-to-application layouts from earlier chapters. This chapter uses a Debian or Ubuntu-style server with Nginx. The log locations may differ on another distribution.2 min read
16Chapter 16: Choosing worker counts and basic tuningThis chapter assumes you understand Linux processes, systemd services, HTTP request flow, Nginx, PHP-FPM, and Gunicorn. You should also know how to inspect memory and CPU usage with commands such as free, top, and systemctl.2 min read