thinkphp5 的nginx v-hosts 设置

 server {
        listen       8089;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        root   "D:/phpStudy/WWW/tp/public";
        location / {
            index  index.html index.htm index.php l.php;
           #autoindex  off;
             if (!-e $request_filename) {
       rewrite ^(.*)$ /index.php?s=/$1 last;
       break;
    }
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
    

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

本地用phpstudy 在配置的tp5的时候 首页可以访问的 但是具体到某个控制器中的方法 一直报404的错误

其实还是主要v-hosts中的 这个
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}

没有 进行配置 导致访问404

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • nginx重写规则 nginx rewrite 正则表达式匹配 大小写匹配 ~ 为区分大小写匹配 ~* 为不区分大...
    桖辶殇阅读 10,896评论 0 2
  • 1.ngnix介绍 ngnix www服务软件 俄罗斯人开发 开源 性能很高 本身是一款静态WWW软件 静态小文件...
    逗比punk阅读 6,370评论 1 6
  • Nginx rewrite基本语法 Nginx的rewrite语法其实很简单.用到的指令无非是这几个: set i...
    Zhaifg阅读 14,896评论 2 21
  • 上一篇《WEB请求处理一:浏览器请求发起处理》,我们讲述了浏览器端请求发起过程,通过DNS域名解析服务器IP,并建...
    七寸知架构阅读 81,447评论 21 356
  • eclipse设置工作空间为UTF-8(适应中文,避免乱码) windows---preference---gen...
    帷幄庸者阅读 1,436评论 0 0