Nginx Reverse Proxy
Definition
A high-performance web server that is heavily used as a Reverse Proxy and Load Balancer sitting in front of Node.js applications.
Explain Like I'm New
Node.js is fantastic at processing business logic, but it is terrible at serving static files (like huge images) or managing SSL/HTTPS certificates. NGINX is the massive steel gate at the front of your server. It catches all incoming internet traffic, handles the HTTPS security instantly, serves static images directly from the hard drive, and then silently passes the complex API requests back to your fragile Node.js app.
Real World Example
A user visits `https://yoursite.com/api/users`. NGINX receives the request on port 443 (HTTPS), decrypts it, and forwards it to your Node app hiding on `localhost:3000`. The Node app processes it, hands the data back to NGINX, and NGINX sends it to the user.
Common Use Cases
- •Handling HTTPS/SSL certificates
- •Serving static assets blazingly fast
- •Load balancing across multiple PM2 instances
Terminal Output
Interview Questions
basic
- What is a Reverse Proxy?
intermediate
- Why not just use Node.js to serve HTTPS traffic directly?