Since the main directory works but `/apps/` does not, the problem is local to that subdirectory. The PHP process cannot read or traverse it.
Use these rules in your Nginx server block. **You must replace `YOUR_PHP_FPM_SOCKET`** with the correct path for your PHP version (e.g., `unix:/var/run/php/php8.2-fpm.sock`).
# 1. Core routing for the directory index
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
# 2. PHP processing block (Replace socket path!)
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/path/to/YOUR_PHP_FPM_SOCKET; # <-- CHANGE THIS!
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# 3. Optional: Cache static assets (like your style/js)
location ~ .*\.(js|css|jpg|png|gif)$ {
expires 1h;
error_log off;
access_log off; # Using 'off' is safer than /dev/null for access_log
}
*Remember to reload Nginx after changing the configuration.*