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

你可能感兴趣的:(thinkphp5 的nginx v-hosts 设置)