I have Slim v4 framework installed with nginx/1.22.0 and php-fpm-8.1.9 on RHEL8. Here is the / location block of current nginx.conf that works fine.
location / {
root /path/to/html/slim;
try_files $uri /index.php$is_args$args;
}
Instead of using location /
, I’d like to use a different location for slim, so that / can be used to host another website. I tried below configuration, but slim gives me 404 Not Found with Slim\Exception\HttpNotFoundException
. Please help me to figure out a way. Thank you!
root /path/to/html;
location /slim {
try_files $uri /index.php$is_args$args;
}
location / {
try_files $uri =404;
}