nginx 隐藏index.php 支持PATHINFO

来源:互联网 发布:淘宝借贷平台 编辑:程序博客网 时间:2024/06/04 19:13

隐藏index.php 

在server{}中增加

location / {

            root   root_dir;
            index  index.html index.htm index.php;
            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php/$1 last;
            }

        }

支持PHP的PATHINFO

location ~* \.php {
             root            root_dir
             fastcgi_index   index.php;
             fastcgi_pass    127.0.0.1:9000;
             include         fastcgi_params;
             fastcgi_split_path_info ^(.+\.php)(.*)$;
             fastcgi_param   PATH_INFO $fastcgi_path_info;
             fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
             include        fastcgi_params;
        }



0 0
原创粉丝点击