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

作者:袖梨 2022-06-30

配置文件

 代码如下 复制代码

/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;
                }  
        }

相关文章

精彩推荐