server { listen 80; server_name localhost; root /var/www/html/public; index index.php; error_log /var/log/apache2/error.log; access_log /var/log/apache2/access.log; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include /etc/apache2/mods-enabled/fastcgi.conf; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; } location ~ /\.ht { deny all; } }