A reverse proxy accepts incoming web requests and forwards them to backend applications. NGINX can route requests by URL while keeping Python and Node.js services behind one public entry point. section 3.6 section 3.6.1
A practical deployment uses a reverse proxy to:
- Expose applications through normal web URLs instead of their application ports. section 3.5.2
- Hide backend applications such as Python and Node.js services from direct access. section 3.6
- Forward traffic to local services or reachable applications on other addresses. section 3.6
- Provide a foundation for load balancing, while leaving advanced balancing details aside. section 3.6
Route two applications with NGINX
Configure one server block to send / to http://localhost:8888, where gunicorn serves the Python application, and /js/ to http://localhost:3000/, where Express runs on Node.js. Enable the site through sites-enabled, remove the default configuration, and restart NGINX. section 3.6.1
Listing 3.34 NGINX reverse proxy configuration
cat <<EOF > /etc/nginx/sites-available/roadtok8s
server {
listen 80;
server_name localhost;
location / {#1
proxy_pass http://localhost:8888;
}
location /js/ {#2
proxy_pass http://localhost:3000/;
}
}
EOF
Inspect the compact NGINX configuration that maps URL locations to the two backend services. section 3.6.1




