为了账号安全,请及时绑定邮箱和手机立即绑定

路由规则不生效

  location / {
    try_files $uri $uri/ /index.php?$query_string;
  }

已经在站点中配置了如下

server {
  listen 80;
  server_name 106.14.205.72;
  access_log /data/wwwlogs/106.14.205.72_nginx.log combined;
  index index.html index.htm index.php;
  root /data/wwwroot/fange;
 
  location / {
    try_files $uri $uri/ /index.php?$query_string;
  }
  #include /usr/local/nginx/conf/rewrite/laravel.conf;
  #error_page 404 /404.html;
  #error_page 502 /502.html;
 
  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
  }
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /\.ht {
    deny all;
  }
}但访问过程除了/外的路由必须带index.php
http://106.14.205.72/blog2/public/basic1  结果File not found.
http://106.14.205.72/blog2/public/? 这个能访问出现laravel的welcom视图
Route::get('/', function () {
    return view('welcome');
});
Route::get('basic1',function(){
    return 'hello world2';
});

正在回答

1 回答

路由代码没问题,应该是其他问题,不太清楚

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
轻松学会Laravel-基础篇
  • 参与学习       64034    人
  • 解答问题       280    个

Laravel框架基础视频教程,轻松入门,了解Laravel的优势

进入课程

路由规则不生效

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信