Nginx隐藏index.php和Pathinfo模式配置例子
程序员文章站
2022-06-20 21:15:17
参照一下对应修改,重启nginx即可
复制代码 代码如下:server { liste...
参照一下对应修改,重启nginx即可
复制代码 代码如下:
server {
listen 80;
server_name www.leiyongbo.com www.leiyongbo.com;
root /usr/local/web;
index index.php;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 405 /errpage/405.html;
###########################################隐藏index.php
location / {
if (!-e $request_filename) {
###一级目录下
rewrite ^/(.*)$ /index.php/$1 last;
###域名下的二级目录
#rewrite ^/目录名/(.*)$ /目录名/index.php/$1 last;
}
}
##########################################pathinfo 模式
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;
}
}
推荐阅读
-
Nginx配置PATHINFO隐藏thinkphp index.php
-
Nginx隐藏index.php和Pathinfo模式配置例子
-
Nginx配置PATHINFO隐藏index.php
-
Nginx配置PATHINFO隐藏index.php
-
Ubuntu下Nginx配置ThinkPHP的Pathinfo和URl Rewrite模式
-
nginx 404页面处理以及pathInfo和隐藏index.php总述
-
studyphp环境软件Nginx隐藏indexphp和Pathinfo模式配置例子 php pathinfo extension ci pathinfo nginx pathinf
-
Nginx配置PATHINFO隐藏thinkphp index.php
-
studyphp环境软件Nginx隐藏indexphp和Pathinfo模式配置例子 php pathinfo extension ci pathinfo nginx pathinf
-
Nginx配置PATHINFO隐藏thinkphp index.php