thinkphp6 Nginx访问环境所有路由都显示首页
Song •
1575 次浏览 •
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;
}
提交评论
请登录后评论
用户评论
当前暂无评价,快来发表您的观点吧...
更多相关好文
-
laravel中distinct()的使用方法与去重 2017-09-11
-
Laravel将view缓存为静态html,laravel页面静态缓存 2021-10-09
-
[ laravel爬虫实战--基础篇 ] guzzle描述与安装 2017-11-01
-
[ 配置教程 ] 在ubuntu16.04中部署LNMP环境(php7+maridb且开启maridb远程以及nginx多域名访问 )并配置laravel环境 2017-07-18
-
Laravel模型更新全表如何实现? 2024-03-11
热门文章
-
Laravel模型更新全表如何实现? 2024-03-11
-
php图片转为二进制数据的方法 2023-10-23
-
Jquery如何监听动态创建元素的点击事件? 2023-09-08
-
所以SheetJS实现table导出数据为Excel 2023-09-05
-
ubuntu crontab设置定时任务教程以及常见命令合集 2023-08-21
ubuntu 如何安装php后如何查看php-fpm.sock文件位置?