下面是我的CentOs服务器的nginx配置文件,现在已经正常可以访问index.php,但现在有一个重写需求,就是我输入23.abc.com/i/abc的时候重写为到23.abc.com/index.php/abc,即把index.php以i代替。请问在下面的基础上,应该如何修改?
server {
listen 80;
server_name 23.abc.com;
index index.html index.htm index.php;
root /home/wwwroot/test/;
location ~ \.php($|/) {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;
}
}
下面是我的CentOs服务器的nginx配置文件,现在已经正常可以访问index.php,但现在有一个重写需求,就是我输入23.abc.com/i/abc的时候重写为到23.abc.com/index.php/abc,即把index.php以i代替。请问在下面的基础上,应该如何修改?
server {
listen 80;
server_name 23.abc.com;
index index.html index.htm index.php;
root /home/wwwroot/test/;
location ~ \.php($|/) {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;
}
}
rewrite 23.abc.com/.*/abc 23.abc.com/index.php/abc break;
1、演示:以截图为准 2、安装说明: 1,运行 你的域名/install/index.php填写相关信息进行安装, 2,安装后运行 你的域名/dede进入后台--系统--数据备份/还原---点击右上数据还原---开始还原数据 3, 系统--系统基本设置--站点设置--域名改为你的域名(否则显示不正常) 这一步很重要 更新主页HTML 更新栏目HTML 更新文档HT
0
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号