thinkphp6 Nginx访问环境所有路由都显示首页
Song •
2490 次浏览 •
0个评论 •
2022年02月18日
Mac环境中的Nginx配置环境后无论访问任何路由都只显示首页,百度后解决办法如下:
server{
listen 80;
server_name tptest.cn;
index index.php index.html index.htm;
root /var/www/tp6test/public;
#autoindex on;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}主要的操作就是配置了:
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
-
php7.4开始hexdec无法处理hex十六进制的办法 2022-02-01 -
git 放弃本地修改,强制拉取更新代码的方法 2022-01-24 -
Composer安装phpoffice/phpspreadsheet出现the requested PHP extension zip is missing from your system 2022-01-22 -
Laravel使用maatwebsite/excel实现Excel/CSV文件导入导出及常见问题解决方案 2022-01-22 -
flex布局控制子元素水平垂直居中 2022-01-21

ubuntu 如何安装php后如何查看php-fpm.sock文件位置?