nginx.conf.example 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Nginx configuration for ShopCall.ai static hosting
  2. # Place this in your nginx sites-available directory and create a symlink in sites-enabled
  3. server {
  4. listen 80;
  5. listen [::]:80;
  6. server_name shopcall.ai www.shopcall.ai;
  7. # Redirect HTTP to HTTPS
  8. return 301 https://$server_name$request_uri;
  9. }
  10. server {
  11. listen 443 ssl http2;
  12. listen [::]:443 ssl http2;
  13. server_name shopcall.ai www.shopcall.ai;
  14. # SSL configuration
  15. ssl_certificate /path/to/your/certificate.crt;
  16. ssl_certificate_key /path/to/your/private.key;
  17. ssl_protocols TLSv1.2 TLSv1.3;
  18. ssl_ciphers HIGH:!aNULL:!MD5;
  19. # Root directory where your built files are located
  20. root /var/www/shopcall.ai/dist;
  21. index index.html;
  22. # Gzip compression
  23. gzip on;
  24. gzip_vary on;
  25. gzip_min_length 1024;
  26. gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
  27. # Cache static assets
  28. location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
  29. expires 1y;
  30. add_header Cache-Control "public, immutable";
  31. }
  32. # React Router - serve index.html for all routes
  33. location / {
  34. try_files $uri $uri/ /index.html;
  35. }
  36. # Security headers
  37. add_header X-Frame-Options "SAMEORIGIN" always;
  38. add_header X-Content-Type-Options "nosniff" always;
  39. add_header X-XSS-Protection "1; mode=block" always;
  40. add_header Referrer-Policy "no-referrer-when-downgrade" always;
  41. add_header Content-Security-Policy "default-src 'self' https: data: 'unsafe-inline' 'unsafe-eval'" always;
  42. # Error pages
  43. error_page 404 /index.html;
  44. }