关于laravel路由无法访问(nginx)

laravel路由无法访问

被这个问题折腾了 好几次了,记录一下希望可以帮到后面的朋友

在laravel路由中配置好了之后无法访问的问题有可能是因为在本地服务配置的问题(我使用的是nginx服务器)

 找到nginx所在文件,打开conf/vhosts/'你的站点名称'

修改location(如下)

server {
listen 80;
server_name localhost;
root "D:/laravel/public";

location / {
  index index.php index.html error/index.html;
  try_files $uri $uri/ /index.php?$query_string;
  }
  location ~ .php(.*)$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    include fastcgi_params;
  }
}

将原来的location改善上面的保存,重启服务器即可

文档参考http://laravel.com/docs/5.0/installation#pretty-urls

相关问题参考https://segmentfault.com/q/1010000002422408

原文地址:https://www.cnblogs.com/carefulyu/p/12666385.html