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

WBOY
Release: 2016-06-06 20:16:48
Original
1324 people have browsed it

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

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

<code>return view('welcome');</code>
Copy after login
Copy after login

});

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

<code>return 'hello world';</code>
Copy after login
Copy after login

});

回复内容:

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

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

<code>return view('welcome');</code>
Copy after login
Copy after login

});

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

<code>return 'hello world';</code>
Copy after login
Copy after login

});

放我的给你参考一下

<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>
Copy after login

你设置rewrite了吗

去掉rewrite,看看

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!