user www-data; worker_processes auto; pid /run/nginx.pid; error_log /dev/stderr warn; events { worker_connections 1024; multi_accept on; } http { include /etc/nginx/mime.types; default_type application/octet-stream; # Logging to stdout/stderr so Docker captures it access_log /dev/stdout; error_log /dev/stderr warn; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml; # Upload size limit (matches file uploads in the app) client_max_body_size 500M; server { listen 80; server_name _; root /var/www/html/public; index index.php; charset utf-8; # Laravel health-check endpoint location = /up { try_files $uri /index.php?$query_string; } # Main catch-all → Laravel router location / { try_files $uri $uri/ /index.php?$query_string; } # PHP-FPM handler location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; # Increase timeouts for long-running requests (PDF export, uploads) fastcgi_read_timeout 300; fastcgi_connect_timeout 60; fastcgi_send_timeout 300; } # Deny access to hidden files (.env, .git, etc.) location ~ /\.(?!well-known).* { deny all; } # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|otf)$ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } } }