Answer the question
In order to leave comments, you need to log in
How to make nginx work with the framework from a folder for a specific location?
There is a directory on the site inside which the framework is deployed. I can’t target calls to the index.php of the framework in any way when called by the name of the directory in the url
/var/www/admin
|-/public/
|--index.php
Url - http://<ip>/admin/someone
location ~ ^/admin/(.*) {
index index.php;
alias /var/www/admin/public;
try_files $uri $uri/ /index.php?$args;
}
Answer the question
In order to leave comments, you need to log in
location ^~ /admin {
root /var/www/admin/public;
rewrite ^/admin/(.*) /$1 break;
try_files $uri /admin/index.php?$args;
location ~ \.php$ {
rewrite ^/admin/(.*) /$1 break;
fastcgi_pass php-fpm;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question