# ============================================================================== # CheckIn App V2 - Nginx Configuration Example (HTTP Only) # ============================================================================== # # Usage: # 1. Copy this file: sudo cp nginx.conf.example /etc/nginx/sites-available/checkin-app # 2. Edit the file and replace placeholders with your actual values # 3. Create symlink: sudo ln -s /etc/nginx/sites-available/checkin-app /etc/nginx/sites-enabled/ # 4. Test config: sudo nginx -t # 5. Reload Nginx: sudo systemctl reload nginx # # ============================================================================== # HTTP Server - Production Configuration server { listen 80; listen [::]:80; server_name your-domain.com; # CHANGE THIS: Replace with your domain or IP # CHANGE THIS: Replace with your actual frontend build path root /var/www/checkin-app; index index.html; # Access and Error Logs access_log /var/log/nginx/checkin-app-access.log; error_log /var/log/nginx/checkin-app-error.log; # Gzip Compression gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript; # Client body size (for file uploads) client_max_body_size 10M; # ========================================== # API Proxy Configuration # ========================================== location /api/ { # Proxy to backend FastAPI server proxy_pass http://127.0.0.1:8000; # Proxy headers 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; # HTTP version and buffering proxy_http_version 1.1; proxy_buffering off; proxy_request_buffering off; # Timeouts proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; } # API Documentation endpoints location ~ ^/(docs|redoc|openapi.json|health) { proxy_pass http://127.0.0.1:8000; 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; } # ========================================== # Frontend Static Files # ========================================== # Cache static assets (JS, CSS, images, fonts) location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # Frontend routes (SPA - Single Page Application) location / { try_files $uri $uri/ /index.html; add_header Cache-Control "no-cache, no-store, must-revalidate"; } # Favicon location = /favicon.ico { log_not_found off; access_log off; } # Robots.txt location = /robots.txt { log_not_found off; access_log off; } } # ============================================================================== # HTTPS Configuration (Currently Commented Out) # ============================================================================== # Uncomment and configure below when you need HTTPS with SSL certificate # # server { # listen 80; # listen [::]:80; # server_name your-domain.com; # # # Redirect HTTP to HTTPS # return 301 https://$server_name$request_uri; # } # # server { # listen 443 ssl http2; # listen [::]:443 ssl http2; # server_name your-domain.com; # # # SSL Certificate (use Let's Encrypt: certbot --nginx) # ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem; # ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem; # # # SSL Configuration # ssl_protocols TLSv1.2 TLSv1.3; # ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256'; # ssl_prefer_server_ciphers off; # ssl_session_cache shared:SSL:10m; # ssl_session_timeout 10m; # # # Security Headers # add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; # add_header X-Frame-Options "SAMEORIGIN" always; # add_header X-Content-Type-Options "nosniff" always; # # # CHANGE THIS: Replace with your actual frontend build path # root /path/to/CheckInApp/frontend/dist; # index index.html; # # # ... (rest of the configuration same as HTTP version above) # }