Nginx is giving me a 404 on my Laminas application when I try to navigate anywhere other than the base URL; from the looks of my log, it seems it is trying to serve routes as files/directories.
I used the information in the Laminas MVC skeleton's README to configure my VH; it looks to me like it should be passing the route to the public directory's index.php, but for some reason it is not.
Here is my configuration (/etc/nginx/sites-available/domain.com):
server {
listen 80 default_server;
listen [::]:80 default_server;
root /sites/domain.com;
index index.php
server_name domain.com;
location / {
index index.php
try_files $uri $uri/ @php;
}
location @php {
# Pass the PHP requests to FastCGI server (php-fpm) on 127.0.0.1:9000
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME /sites/domain.com/index.php;
include fastcgi_params;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}