server { listen 80; listen [::]:80; server_name _; # Nginx will look for files in this directory root /var/www/html/public; # The default file to serve index index.php index.html; charset utf-8; # Route all requests to index.php (Laravel's front controller) location / { try_files $uri $uri/ /index.php?$query_string; } # Serve static Vite assets directly (cache them for performance) location ~* \.(jpg|jpeg|gif|png|css|js|ico|webp|svg|woff|woff2|ttf|eot)$ { expires max; access_log off; } # Pass PHP scripts to the PHP-FPM container location ~ \.php$ { fastcgi_pass app:9000; # "app" is the name of the service in docker-compose.yml fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; fastcgi_hide_header X-Powered-By; } # Block access to hidden files (like .env or .git) location ~ /\.(?!well-known).* { deny all; } }