Nginx server block guides
Use this path when Nginx needs to send the right hostname to the right files or backend. It covers server blocks, roots, redirects, routing rules, and deployment-safe config structure.
Curated guides
Nginx server block guides
37 matched guides, newest first. Page 1 of 4.

How to Configure Nginx Server Blocks and Virtual Hosts
Nginx server blocks let one Nginx service host multiple domains, subdomains, or applications from separate configuration blocks. Apache users often call this virtual hosting; Nginx documentation usually calls...

How to Allow or Block IP Addresses in Nginx
IP-based access rules are useful when an admin path, staging site, partner endpoint, or private dashboard should not be reachable by every visitor that can reach the Nginx...

Nginx Location Block Priority Explained
Nginx location block priority explains why a request such as /assets/app.css may be handled by a regex block even when a normal location /assets/ block exists. The matching...

How to Create an Nginx Reverse Proxy
A reverse proxy becomes useful as soon as a local app needs a public domain, TLS, and one clean entry point. An Nginx reverse proxy gives private Node.js,...

How to Configure TLS Settings in Nginx
Default HTTPS snippets become hard to trust when Nginx inherits broad protocol lists from copied server blocks, Certbot includes, or hosting-panel templates. When you configure TLS settings in...

How to Restore Real Client IPs in Nginx Behind Cloudflare or a Reverse Proxy
Restoring real client IPs in Nginx becomes necessary when Cloudflare, a load balancer, a CDN, or an internal reverse proxy connects to the origin first. Without a trusted...

How to Configure Nginx PHP-FPM
Nginx does not execute PHP by itself. It serves static files directly and sends PHP requests to PHP-FPM through FastCGI. When that handoff is wrong, the symptoms are...

Enable the Nginx Sendfile Directive
Large static-file responses can make Nginx spend CPU time copying data it does not need to inspect. To enable sendfile in Nginx, set the sendfile directive so direct...

Create Nginx Rewrite Rules with return and rewrite
Nginx rewrite rules are useful when a URL move needs more than a one-off redirect, but they can also cause loops, duplicate query strings, or open redirects when...

How to Enable TCP Fast Open in Nginx
Enable TCP Fast Open in Nginx only when the listener can safely accept request data before the TCP handshake fully completes. The workflow is to enable Linux server-side...

Enable Nginx reuseport for HTTP, Stream and QUIC Listeners
Busy Nginx servers can spend surprising time coordinating which worker accepts the next connection. The reuseport parameter on the Nginx listen directive uses the operating system's SO_REUSEPORT support...

Configure Nginx Rate Limiting with limit_req
A login form, search endpoint, or API route can overload a backend long before the rest of the site looks busy. Nginx rate limiting caps request frequency at...