Nginx Location Matching Explained: Prefix, Regex, and Exact Matches

nginx location matching

Your Nginx server block looks right, the config test passes, and still the wrong page loads. A request for /api/users lands on your static site, while /images/logo.png gets handed to PHP-FPM. In most cases the cause is nginx location matching, the set of rules that decides which location block handles each request. Those rules are … Baca Selengkapnya

Nginx Location Block Priority: How Request Matching Really Works

Nginx decides which location block handles a request through a matching process that surprises many admins. Two location blocks can both match the same URL, and the one that wins is not always the one listed first or the one that looks most specific. This guide explains nginx location block priority in plain terms: the … Baca Selengkapnya

How to Redirect HTTP to HTTPS in Nginx (3 Methods)

Serving a site over plain HTTP in 2026 is a problem for both security and trust. Browsers warn visitors, login forms and cookies travel unprotected, and search engines prefer the HTTPS version of a page. The fix is a redirect: every HTTP request should land on the HTTPS version of the same URL. This guide … Baca Selengkapnya