【发布时间】:2019-01-11 07:18:42
【问题描述】:
我正在尝试使用 Nginx 设置我的 Laravel 项目。我的/etc/nginx/conf.d/default.conf 是:
server {
listen 80;
index index.php index.html;
root /var/www/public;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
我对带有“.php”结尾的路由有疑问,例如
Route::get('modules.php', 'ModuleController@index');
服务器尝试打开不存在的文件modules.php,而不是去index.php 并在那里查看路由。
我知道,nginx设置中的那个问题,但我没有经验,所以我无法自己解决。
【问题讨论】: