server { listen 80; listen [::]:80; server_name localhost; root /var/www/html/public; index index.php; charset utf-8; # Health check endpoint location /health { access_log off; return 200 "healthy\n"; add_header Content-Type text/plain; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } # Static files location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|eot|webp)$ { expires 1y; access_log off; add_header Cache-Control "public, immutable"; try_files $uri =404; } # Vite build assets location /build/ { expires 1y; access_log off; add_header Cache-Control "public, immutable"; try_files $uri =404; } # Storage location /storage/ { expires 7d; add_header Cache-Control "public"; try_files $uri =404; } # Main location location / { try_files $uri $uri/ /index.php?$query_string; } # PHP processing location ~ \.php$ { fastcgi_pass php-fpm; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_hide_header X-Powered-By; } # Deny hidden files location ~ /\. { deny all; } error_page 404 /index.php; }