etsy-finance-tracker/nginx.deploy.conf
dlawler489 89ee6e69fc Enhanced deployment with comprehensive bug fixes and documentation
- Fixed nginx 404 errors with enhanced file copying and fallback configuration
- Added docker-compose.simple.yml for streamlined first-time deployment
- Enhanced docker-compose.deploy-local.yml with detailed debugging and health checks
- Improved nginx.deploy.conf with fallback pages and auto-refresh
- Added comprehensive DEPLOYMENT_GUIDE.md with multiple deployment options
- Created validate-deployment.sh script for environment validation
- Updated container interface deployment documentation
- Added DEPLOYMENT_STATUS.md summary of ready features

Deployment improvements:
- Enhanced container startup sequence with health checks
- Detailed logging for troubleshooting file copying issues
- Multiple deployment strategies for different use cases
- Fallback nginx configuration prevents 404 errors during startup
- Auto-refresh functionality for seamless user experience

Ready for production deployment via container interfaces or command line.
2026-04-21 13:18:09 +10:00

83 lines
No EOL
2.6 KiB
Text

events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
# Basic settings
sendfile on;
keepalive_timeout 65;
client_max_body_size 20M;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Upstream backend
upstream etsy_api {
server etsy-finance-tracker:8080;
}
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Health check endpoint (proxied to backend)
location /health {
proxy_pass http://etsy_api;
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;
}
# API routes - proxy to backend
location /api/ {
proxy_pass http://etsy_api;
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;
}
# Static assets with caching
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# React app - serve index.html for all routes (SPA support)
location / {
try_files $uri $uri/ /index.html @fallback;
# Prevent caching of index.html
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
}
# Fallback for missing client files
location @fallback {
return 200 '<html><head><title>Etsy Finance Tracker</title></head><body><h1>🚀 Etsy Finance Tracker Starting Up...</h1><p>Client files are being loaded. Please refresh in a moment.</p><script>setTimeout(function(){location.reload()}, 5000);</script></body></html>';
add_header Content-Type text/html;
}
# Error pages
error_page 404 /index.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}