docs: Add Nginx reverse proxy configuration guide
- Added comprehensive Nginx Proxy Manager setup instructions - Documented HTTPS to HTTP routing requirements - Included common proxy issues and troubleshooting - Added standard Nginx configuration examples - Clarified SSL termination at proxy level
This commit is contained in:
85
README.md
85
README.md
@@ -307,6 +307,91 @@ The URL shortener feature uses the `APP_DOMAIN` environment variable to generate
|
||||
|
||||
Short URLs will be available at: `https://[your-domain]/s/[short-code]`
|
||||
|
||||
## 🌐 Reverse Proxy Configuration (Nginx)
|
||||
|
||||
When deploying behind a reverse proxy like Nginx Proxy Manager or standard Nginx, configure the proxy to route **HTTPS traffic to HTTP backend**:
|
||||
|
||||
### ⚠️ Important Proxy Configuration
|
||||
|
||||
- **Frontend (Public)**: HTTPS (Port 443)
|
||||
- **Backend (Docker)**: HTTP (Port 8066)
|
||||
- **SSL Termination**: At the proxy level
|
||||
|
||||
### Nginx Proxy Manager Setup
|
||||
|
||||
1. **Create Proxy Host**:
|
||||
- Domain: `qr.moto-adv.com` (your domain)
|
||||
- Forward Hostname/IP: `your-server-ip`
|
||||
- Forward Port: `8066`
|
||||
- **Protocol**: HTTP (not HTTPS)
|
||||
|
||||
2. **SSL Configuration**:
|
||||
- Enable SSL certificate (Let's Encrypt)
|
||||
- Force SSL: Yes
|
||||
- HTTP/2 Support: Yes
|
||||
|
||||
3. **Advanced Settings** (if needed):
|
||||
```nginx
|
||||
# Custom Nginx configuration
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
```
|
||||
|
||||
### Standard Nginx Configuration
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name qr.moto-adv.com;
|
||||
|
||||
# SSL Configuration
|
||||
ssl_certificate /path/to/ssl/cert.pem;
|
||||
ssl_certificate_key /path/to/ssl/private.key;
|
||||
|
||||
# Proxy to Docker container
|
||||
location / {
|
||||
proxy_pass http://localhost:8066; # Note: HTTP, not HTTPS
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
}
|
||||
}
|
||||
|
||||
# Redirect HTTP to HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
server_name qr.moto-adv.com;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
```
|
||||
|
||||
### Common Proxy Issues & Solutions
|
||||
|
||||
| Issue | Cause | Solution |
|
||||
|-------|-------|----------|
|
||||
| 502 Bad Gateway | HTTPS→HTTPS routing | Change backend to HTTP |
|
||||
| SSL errors | Missing certificates | Configure SSL at proxy level |
|
||||
| 404 on subpaths | Missing headers | Add proxy headers |
|
||||
| Session issues | Domain mismatch | Set correct `APP_DOMAIN` |
|
||||
|
||||
### Docker Configuration for Proxy
|
||||
|
||||
Ensure your `docker-compose.yml` exposes the correct port:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
qr-manager:
|
||||
ports:
|
||||
- "8066:5000" # Maps container port 5000 to host port 8066
|
||||
environment:
|
||||
- APP_DOMAIN=qr.moto-adv.com # Your public domain
|
||||
```
|
||||
|
||||
## 📱 Usage
|
||||
|
||||
### Generating QR Codes
|
||||
|
||||
Reference in New Issue
Block a user