server { listen 80; server_name localhost; # host header (not used locally) root /var/www/html/public; # Symfony's public/ dir (front controller) location / { # Serve static files if present, otherwise route to index.php try_files $uri /index.php$is_args$args; } location ~ \.php$ { # Forward PHP requests to php-fpm service include fastcgi_params; fastcgi_pass php:9000; # Use resolved path to avoid path traversal issues fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root; internal; } error_log /var/log/nginx/error.log; # server error log access_log /var/log/nginx/access.log; # request access log }