一聚教程网:一个值得你收藏的教程网站

热门教程

nginx中隐藏index.php文件配置方法

时间:2022-06-30 18:43:52 编辑:袖梨 来源:一聚教程网

配置文件

 代码如下 复制代码

/www/wdlinx/nginx-1.2.8/xxxx.com.conf

#将默认的localhost块替换成

 代码如下 复制代码
location ~ .php($|/) {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info ^(.+.php)(.*)$;
            fastcgi_param   PATH_INFO $fastcgi_path_info;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

隐藏掉index.php

 代码如下 复制代码

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

热门栏目