# Example nginx configuration for SvelteKit Node.js app # Place this in: /etc/nginx/sites-available/floter-design # Then create symlink: sudo ln -s /etc/nginx/sites-available/floter-design /etc/nginx/sites-enabled/ # Test config: sudo nginx -t # Reload: sudo systemctl reload nginx # OPTION 1: Using IP address (use this if you don't have a domain) # Replace '_' with your actual IP address if you want to be more specific # For example: server_name 123.45.67.89; server { listen 80; listen [::]:80; server_name _; # '_' catches all requests, or use your IP address like: 123.45.67.89 # DO NOT set root directive - we're proxying everything to Node.js # root /var/www/html; # REMOVE THIS if it exists # Redirect HTTP to HTTPS (uncomment after setting up SSL) # return 301 https://$server_name$request_uri; # Proxy ALL requests (including assets) to Node.js server # Use 127.0.0.1 instead of localhost to force IPv4 (localhost can resolve to IPv6 ::1) location / { proxy_pass http://127.0.0.1:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; 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_cache_bypass $http_upgrade; # Increase timeouts for long-running requests proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; # Ensure all paths are passed through correctly proxy_redirect off; } } # OPTION 2: Using domain name (uncomment this and comment out OPTION 1 when you have a domain) # server { # listen 80; # listen [::]:80; # server_name your-domain.com www.your-domain.com; # Replace with your domain # # location / { # proxy_pass http://127.0.0.1:3001; # proxy_http_version 1.1; # proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection 'upgrade'; # 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_cache_bypass $http_upgrade; # # proxy_connect_timeout 60s; # proxy_send_timeout 60s; # proxy_read_timeout 60s; # } # } # When you get a domain, you can add HTTPS configuration below: # HTTPS configuration (uncomment and configure after SSL certificate setup) # server { # listen 443 ssl http2; # listen [::]:443 ssl http2; # server_name your-domain.com www.your-domain.com; # # # SSL certificate paths (use Let's Encrypt or your certificate) # 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 HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # # location / { # proxy_pass http://127.0.0.1:3001; # proxy_http_version 1.1; # proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection 'upgrade'; # 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_cache_bypass $http_upgrade; # # proxy_connect_timeout 60s; # proxy_send_timeout 60s; # proxy_read_timeout 60s; # } # }