Я добавил блок местоположения для обслуживания приложения Laravel из подчиненного URI (только) в / todos /
location /todos {
try_files $uri $uri/ /todos/$query_string;
index index.php index.html index.htm;
root /index.php;
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_read_timeout 300;
fastcgi_pass unix:/opt/bitnami/php/var/run/www.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME /opt/bitnami/nginx/html/todos/public/index.php;
fastcgi_param QUERY_STRING $query_string;
include fastcgi_params;
}
}
Но переход к / todos / URI не работает (обслуживает 403Запрещено), это требует от меня фактического добавления в «index.php» - так что Laravel работает только с /todos/index.php.
Что я делаю не так?
ОБНОВЛЕНИЕ: Рабочая конфигурация:
location /todos {
try_files $uri $uri/ /todos/index.php?$query_string;
index index.php index.html index.htm;
root /opt/bitnami/nginx/html/todos/public/;
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_read_timeout 300;
fastcgi_pass unix:/opt/bitnami/php/var/run/www.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME /opt/bitnami/nginx/html/todos/public/index.php;
fastcgi_param QUERY_STRING $query_string;
include fastcgi_params;
}
}