美文网首页
nginx 支持pathinfo

nginx 支持pathinfo

作者: 大史叔叔 | 来源:发表于2019-03-06 17:21 被阅读0次

查看nginx.conf的路径

$ nginx -t

nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

编辑nginx.conf文件,修改以下两处

$ vim /usr/local/etc/nginx/nginx.conf

location / {
            if (!-e $request_filename) {
                rewrite  ^/(.*)$  /index.php/$1  last;
                break;
            }
        }
location ~ [^/]\.php(/|$){

            root           /usr/local/var/www/tp5/public/;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;

            include        fastcgi_params;

            set $path_info "";
            set $real_script_name $fastcgi_script_name;
            if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                set $real_script_name $1;
                set $path_info $2;
            }
            fastcgi_param PATH_INFO       $path_info;
            fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
            fastcgi_param SCRIPT_NAME     $real_script_name;

        }

相关文章

网友评论

      本文标题:nginx 支持pathinfo

      本文链接:https://www.haomeiwen.com/subject/ftexpqtx.html