php - larval 路由只有 '/' 可以访问,其他路由都是404
本文介绍了php - larval 路由只有 '/' 可以访问,其他路由都是404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
环境是 nginx+php-fpm
nginx配置如下:
路由配置:
Route::get('/', function () {
return view('welcome');
});
Route::get('hello',function(){
return 'hello world';
});
解决方案
放我的给你参考一下
server
{
listen 80;
server_name Xxx.xxx.com;
index index.php index.html index.htm;
root /xxx/xxx/xxx/public;
access_log /xxx/xxx/xxx.log access;
location ~ .*\.(php)?$
{
try_files $uri = 404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location / {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?s=/$1 last;
}
#try_files $uri $uri/ /index.php?$query_string;
}
}
这篇关于php - larval 路由只有 '/' 可以访问,其他路由都是404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文