nginx伪静态规则配置
2023-03-07 09:49:31 时间
服务器配置文件:
server{
listen 80;
server_name www.abc.com;
root "D:/phpStudy/WWW/abc";
location / {
index index.php index.htm /public/index.html;
autoindex off;
include abc.conf;
#rewrite a.html /index.php/front/index/index last;
}
location ~ .php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
伪静态配置文件可以直接写在 location / {} 里面的,不推荐这样做,建议新增加个rewrite.conf写伪静态文件会好点,include 进来就行了,这样可以在rewrite.conf里面写n多配置
location / { index index.php index.htm /public/index.html;
autoindex off;
include rewrite.conf; #rewrite a.html /index.php/front/index/index last;
}
rewrite.conf (这个文件自己创建就行了,文件内容写规则)
#场景一的规则
#http://www.abc.com/index.php/front/index/indexrewrite a.html /index.php/front/index/index last;
#场景二的规则
#1.http://www.abc.com/index.php/front/index/parse/name/yangxignyi/age/18
#2.http://www.abc.com/index.php/front/index/parse?name=yangxignyi&age=18
#3.http://www.abc.com/parse-yangxingyi-18.htmlrewrite parse-(w+)-(d+).html /index.php/front/index/parse/name/$1/age/$2 last;
最后,重启nginx!
.pwarm{ text-indent:0px !important; padding: 5px !important; } .pwarm p,a,span{ text-indent:0px !important; word-break: break-all; }
未经允许不得转载:肥猫博客 » nginx伪静态规则配置
相关文章
- 在 Go 里用 CGO?这 7 个问题你要关注!
- 9款优秀的去中心化通讯软件 Matrix 的客户端
- 求职数据分析,项目经验该怎么写
- 在OKR中,我看到了数据驱动业务的未来
- 火山引擎云原生大数据在金融行业的实践
- OpenHarmony富设备移植指南(二)—从postmarketOS获取移植资源
- 《数据成熟度指数》报告:64%的企业领袖认为大多数员工“不懂数据”
- OpenHarmony 小型系统兼容性测试指南
- 肯睿中国(Cloudera):2023年企业数字战略三大趋势预测
- 适用于 Linux 的十大命令行游戏
- GNOME 截图工具的新旧截图方式
- System76 即将推出的 COSMIC 桌面正在酝酿大变化
- 2GB 内存 8GB 存储即可流畅运行,Windows 11 极致精简版系统 Tiny11 发布
- 迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
- loongarch架构介绍(三)—地址翻译
- Go 语言怎么解决编译器错误“err is shadowed during return”?
- 敏捷:可能被开发人员遗忘的部分
- Denodo预测2023年数据管理和分析的未来
- 利用数据推动可持续发展
- 在 Vue3 中实现 React 原生 Hooks(useState、useEffect),深入理解 React Hooks 的