Как сделать перенаправление поддериктории nginx на другой root
есть такой конфиг, немогу запустить index.php из поддиректории /tests/ root /var/www/devsdk/tests/test_api/web/index.php - реальное расположение файла;
root /var/www/devsdk/frontend/web;
index index.php;
location / {
try_files $uri $uri/ /index.html /index.php?$args;
}
location /tests/ {
#/var/www/devsdk/tests/test_api/web
root /var/www/devsdk/tests/test_api/web;
try_files $uri/tests/ /tests/index.html /tests/index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_split_path_info ^(\/index\.php)(.*)$;
try_files $uri =404;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/web.sock;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
}
Источник: Stack Overflow на русском