🔧 Container Interface Deployment Fix: - Use nginx.deploy.conf for deployment-specific nginx config - Add command to copy client files to shared volume - Improve startup logging and error handling - Ensure client files are available to nginx container ✅ Deployment Ready: - Works with Portainer, Docker Desktop, and similar interfaces - Copies React build files from API container to nginx volume - Proper container startup sequence and health checks - Clear logging for troubleshooting startup issues This fixes the missing client files issue when deploying from container management interfaces.
77 lines
No EOL
2.2 KiB
Text
77 lines
No EOL
2.2 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;
|
|
|
|
# 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";
|
|
}
|
|
}
|
|
|
|
# Error pages
|
|
error_page 404 /index.html;
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|
|
} |