Reverse proxy for Next.js and NestJS
DEVNU / TECHNOLOGY / NGINX
Nginx is often the public edge of the system, so its configuration is production application code.
Nginx is more than a redirect to localhost. TLS, proxy headers, body sizes, timeouts, static caching and route precedence directly affect security and user experience.
What does Nginx own in a project?
On DEVNU VPS deployments, Nginx is commonly the only application-facing service on ports 80/443 and proxies traffic to frontend or API services on the host/private network. Certificates, redirects and file routes are controlled at the same edge.
Where the technology should solve a specific problem.
TLS termination and HTTPS redirects
Static file and catalogue delivery
WebSocket proxying
Upload/body-size control
Security headers and cache policy
When we reach for it
Multiple subdomains, Next.js plus APIs, static files, uploads, WebSockets and the need for explicit edge control on a VPS are natural fits.
When we leave it out
On platforms that fully manage CDN and ingress, a custom Nginx layer may duplicate responsibility. Complex business authentication also belongs in the application rather than being encoded into proxy rules.
Using the tool is easy. Operating it well is the real work.
- 01Separate server blocks for hostnames
- 02Standard proxy headers
- 03Endpoint-appropriate timeouts
- 04No direct backend-port exposure
- 05Configuration tests before reloads
- 06Logs usable during incidents
The decisions matter more than the stack badge.
Nginx or Cloudflare?
They usually complement each other. Cloudflare handles public-edge DNS/CDN/WAF responsibilities while Nginx controls ingress at the origin.
Serve static files from the app or Nginx?
Immutable assets or large catalogues can be more efficient directly through Nginx; permission-sensitive files should pass through an authorised application path.
Reload or restart?
Configuration testing followed by graceful reload is preferred for normal changes so active connections are not needlessly interrupted.
Projects where Nginx is part of the recorded stack.
PasarGuard — Telegram commerce & operations
A personal product that brings ordering, wallet balance, service delivery and reseller operations into one Telegram bot and Mini App flow.
- Telegram
- React
- TypeScript
- FastAPI
- PostgreSQL
- Redis
- Docker
- Nginx
DEVNU Science — Scientific Research Workspace
A connected research workspace that moves from a gene, protein, variant, disease or sequence into evidence, 3D structure, analysis and repeatable workflows without aimless database hopping.
- Next.js
- React
- TypeScript
- PostgreSQL
- Drizzle
- Better Auth
- GSAP
- Nginx
Technology only matters inside a useful outcome.
Common questions about Nginx
01Is Nginx required for Next.js?+
Not on every hosting platform. On a VPS where Next.js runs as a Node process or container, Nginx is a common controllable reverse proxy and TLS edge.
02Can Nginx handle large files efficiently?+
Yes for static delivery, provided timeouts, range requests, caching and file access are configured for the use case.
09 / NEXT STEP
Start with the problem. Choose the stack second.
If the project needs this technology, the reason should be visible in architecture, performance, user experience or maintenance cost.
Describe the project