Nginx: route to index.php within alias for specific path component
You're pretty close. But you need to match the trailing /
characters for location
and its corresponding alias
.
You also need to add a try_files
in that block to refer to the correct index.php
, which is probably /api/index.php
.
location /api/ {
alias /home/user/api/public/;
try_files $uri /api/index.php;