TP框架在nginx中的配置
2024-10-21 03:44:02
TP框架配置中默认URL_MODEL=1,而Nginx默认是不支持PATHINFO的。如果我们只想跑起来tp框架,很简单,只需到更改TP配置,设置URL_MODEL=3(兼容模式)。但是如果要让Nginx支持ThinkPHP PATHINFO需要做如下配置: 1、设置ThinkPHP URL模式URL_MODEL=1; 2、修改nginx配置文件(红色部分更改称相应的内容)
server
{
listen 80;
server_name www.myblog.com;
index index.php;
root /Users/just/git/myblog; location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
} location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
}
最新文章
- 看懂mysql执行计划--官方文档
- window.open和window.location.href的几种用法
- javascript中的冒泡排序
- OpenLDAP安装
- 关于mvc ajax (post提交)——页面传值以及后台接收
- vb---输入模式之文本输入与二进制输入区别
- java 15 -3 集合的遍历的练习
- 281.	Zigzag Iterator
- poj 1581 A Contesting Decision
- PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题
- POJ 2185 Milking Grid(KMP)
- I.MX6 android 移除shutdown功能
- Java常用API解析——序列化API
- asp.net web api 文件上传
- Python调用ansible API系列(三)带有callback的执行adhoc和playbook
- java 11 实现RFC7539中指定的ChaCha20和Poly1305两种加密算法, 代替RC4
- php用PDO查询mysql数据库结果中文乱码
- VS2015应用NuGet
- Hankson 的趣味题
- mysql中engine=innodb和engine=myisam的区别(转)
热门文章
- django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: rest_framework_swagger
- JavaScript:严格模式";use strict";
- texlive编译lshort-zh-cn
- $_GET方法踩坑
- 12、HSSFWorkbook实现多张sheet导出
- 还原火山引擎 A/B 测试产品——DataTester 私有化部署实践经验
- 分享自己亲测过的Visualstudio 2019中开发Typescript时,设置自动编译生成js,无需手工运行命令生成的方法。
- [MySQL] 索引的使用、SQL语句优化策略
- Coolify系列-手把手教学解决局域网局域网中的其他主机访问虚拟机以及docker服务
- 前端必备基础知识之--------原生JS发送Ajax请求