server { listen 80; listen [::]:80; server_name localhost; # Root directory for the built React app root /usr/share/nginx/html; # Serve index.html for all routes location / { try_files $uri /index.html; } # Serve static files directly location ~* \.(?:ico|css|js|gif|jpg|jpeg|png|svg|woff2?|eot|ttf|otf)$ { expires max; add_header Cache-Control "public"; } # Optional: Log errors error_log /var/log/nginx/error.log warn; access_log /var/log/nginx/access.log; }