Setting Up Nginx as a Reverse Proxy on Raspberry Pi
Setting Up Nginx as a Reverse Proxy on Raspberry Pi Route traffic to multiple home services under one entry point with HTTPS support. Install Nginx bash sudo apt install nginx -y sudo systemctl enable nginx Test: navigate to http://raspberrypi.local Basic Reverse Proxy Config Create /etc/nginx/sites-available/home: nginx server { listen 80; servername homeassistant.local; location / { proxypass http://localhost:8123; proxysetheader Host $host; proxysetheader X-Real-IP $remoteaddr; proxysetheader X-Forwarded-For $proxyaddxforwardedfor; proxysetheader X-Forwarded-Proto $scheme; } } Enable: bash sudo ln -s /etc/nginx/sites-available/home /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx Path-Based Routing nginx location /pihole/ { proxypass http://localhost:8080/; } location /grafana/ { proxypass http://localhost:3000/; } HTTPS with Let's Encrypt bash sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d yourdomain.com Auto-renews — no manual action needed. WebSocket Support Required for Home Assistant and other apps: nginx proxyhttpversion 1.1; proxysetheader Upgrade $httpupgrade; proxysetheader Connection "upgrade";
Related Guides
- Raspberry Pi: Complete Headless Setup Guide (No Monitor Needed)
- Power over Ethernet for Maker Electronics: Passive vs 802.3af/at/bt, Splitting and Injecting PoE
- Build a WireGuard VPN Server on a Raspberry Pi: Secure Remote Access to Your Home Network
- Building a Wake-on-LAN Server with Raspberry Pi
- How to Install Klipper on Any 3D Printer: Complete Setup Guide
- How to Set Up OpenCV Machine Vision on a Raspberry Pi
- Raspberry Pi: Headless OS Setup
- How to Set Up a Raspberry Pi Headless with SSH and WiFi