>  기사  >  백엔드 개발  >  larval 路由只有 '/' 可以访问,其他路由都是404

larval 路由只有 '/' 可以访问,其他路由都是404

WBOY
WBOY원래의
2016-06-06 20:16:481336검색

环境是 nginx+php-fpm
nginx配置如下:
larval 路由只有 '/' 可以访问,其他路由都是404

路由配置:
Route::get('/', function () {

<code>return view('welcome');</code>

});

Route::get('hello',function(){

<code>return 'hello world';</code>

});

回复内容:

环境是 nginx+php-fpm
nginx配置如下:
larval 路由只有 '/' 可以访问,其他路由都是404

路由配置:
Route::get('/', function () {

<code>return view('welcome');</code>

});

Route::get('hello',function(){

<code>return 'hello world';</code>

});

放我的给你参考一下

<code>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;
  }
}</code>

你设置rewrite了吗

去掉rewrite,看看

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.