39 lines
1.3 KiB
Nginx Configuration File
39 lines
1.3 KiB
Nginx Configuration File
# Nginx reverse proxy configuration for stock-data-backend
|
|
# Domain: signal.thiessen.io → localhost:8998 (uvicorn)
|
|
#
|
|
# Installation:
|
|
# sudo cp deploy/nginx.conf /etc/nginx/sites-available/stock-data-backend
|
|
# sudo ln -s /etc/nginx/sites-available/stock-data-backend /etc/nginx/sites-enabled/
|
|
# sudo nginx -t && sudo systemctl reload nginx
|
|
#
|
|
# SSL/TLS (recommended):
|
|
# sudo apt install certbot python3-certbot-nginx
|
|
# sudo certbot --nginx -d signal.thiessen.io
|
|
# Certbot will automatically modify this file to add SSL directives.
|
|
|
|
server {
|
|
listen 80;
|
|
server_name signal.thiessen.io;
|
|
|
|
# Redirect all HTTP to HTTPS (uncomment after certbot setup)
|
|
# return 301 https://$host$request_uri;
|
|
|
|
# Map API requests to the Python backend
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:8998;
|
|
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_read_timeout 120s;
|
|
proxy_connect_timeout 10s;
|
|
}
|
|
|
|
# Serve the compiled Node.js frontend directly
|
|
location / {
|
|
root /opt/signalplatform/frontend/dist;
|
|
index index.html;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|