您的位置:首页 > 运维架构 > Nginx

nginx 隐藏index.php 支持PATHINFO

2016-04-17 11:31 525 查看
隐藏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;

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: