server {
listen 80;
client_max_body_size 3M;
root /var/www/html/project/project_bb/public;
index index.php index.html index.htm;
server_name project.loc;
access_log /var/log/nginx/project_access.log;
error_log /var/log/nginx/project_error.log;
error_page 404 /404.html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param APPLICATION_ENV dev;
fastcgi_param PHP_VALUE "date.timezone=Asia/Kolkata";
fastcgi_read_timeout 300;
add_header Access-control-Allow-Origin *;
include fastcgi_params;
}
location ~/testfolder/ {
try_files $uri $uri/ /testfolder/index.html;
}
location /test {
alias /var/www/html/project/testfolder;
}
location /api {
alias /var/www/html/project/apiclient_project/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param APPLICATION_ENV dev;
fastcgi_param PHP_VALUE "date.timezone=Asia/Kolkata";
fastcgi_read_timeout 300;
#include fastcgi_params;
}
try_files $uri $uri/ ~/index.php?$args;
location ~ /\.ht {
deny all;
}
}
location /. { ## Disable .htaccess and other hidden files
return 404;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
}
我在laravel项目中嵌套了一个苗条的框架,我需要设置nginx配置,使得project / api应该是别名,当前我正在使用代理。在传递try_files时传递错误论点,因为苗条的框架无法在嵌套位置传递或获取api的论点,请让我知道是否需要更改