At some point in our development journey, we’ve all played around with domains, subdomains, routes, reverse proxies, and enough DNS records to make us question our life choices.
What if you want a completely different website to appear at a specific path of your existing domain?
It is built with Next.js because I want server-side rendering, good performance, solid SEO, and enough flexibility to customize pretty much everything.
Not just because everyone keeps saying content is king, but because I want to publish useful content, build topical authority, attract organic traffic, and generally give the website more reasons to exist than just "here are our cakes."
Or I could save myself the headache and use WordPress or another CMS that already solved most of these problems years ago.
This is where reverse proxies and path-based routing come in. What Is a Reverse Proxy?
A reverse proxy is a server that sits between the client and one or more backend servers.
Instead of the browser directly talking to my application server, it talks to the reverse proxy.
The important thing here is that the user doesn't need to know about 172.1.0.1 or 172.1.0.2.
Nginx is the one making the decision about which server should actually handle the request.
Internally, it can be several completely independent applications. Reverse Proxy vs Redirect
This distinction confused me the first time I started working with proxy configurations, so it's worth making explicit.
The browser never needs to know that Nginx forwarded the request somewhere else.
the browser continues to show that URL even if Nginx actually fetched the content from:
All of these can potentially live on completely different servers or services. The Architecture
Once the HTTP request reaches Nginx, Nginx looks at the request path and decides what to do with it.
But let's break it down instead of treating Nginx configuration like ancient magic that must be copied from Stack Overflow without questioning it.
In a real production deployment, I'd normally be dealing with HTTPS and port 443, but I'm keeping the first example intentionally simple.
