
请问Laravel5.3在Nginx1.8.1中只能显示首页,其它所有页面都显示403 Forbidden是什么原因? 5
在Laravel的路由文件web.php中Route::get('/',function(){//显示结果页面Laravel首页在Nginx下可正常显示returnvie...
在Laravel的路由文件web.php中Route::get('/', function ( ) { // 显示结果页面Laravel首页在Nginx下可正常显示 return view('welcome'); });Route::get('a', function ( ) { // 结果页面在Nginx下提示错误403 Forbidden return 123456;});在Nginx的配置文件中 server { listen 80; server_name localhost; root /www/web/default; index index.php index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ /index.php?$query_string; autoindex on; autoindex_exact_size on; autoindex_localtime on; } location @rewrite { rewrite ^/(.*)$ /index.php?_url=/$1; } location ~ \\.php(.*)$ { fastcgi_pass unix:/tmp/php-56-cgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name; fastcgi_param PATH_INFO $1; include fcgi.conf; try_files $uri $uri/ /index.php?$query_string; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } }目录的权限也都给了777,但还是报403 Forbidden,在路径中,除了使用“/”斜线可以打开首页外,其它的在“/”斜线后添加的任何字符(任何路由),比如“/a”,全部报403 Forbidden,不知道问题出在哪里,请教各位帮忙看看,谢谢!
展开
1个回答
2018-09-28
展开全部
server {
listen 80;
server_name xxx;
root /xxx/public;
index index.php index.html index.htm;
location / {
add_header Access-Control-Allow-Origin *;
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.(php|php5)?$ {
add_header Access-Control-Allow-Origin *;
#fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^.+\.(gif|jpg|jpeg|png|ico|swf|flv)$ {
expires 30d;
}
}
你把xxx换成你自己的路径和域名,试试看
追问
谢谢!改成bublic目录也不行啊?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?

2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询