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

  

最新文章

  1. 看懂mysql执行计划--官方文档
  2. window.open和window.location.href的几种用法
  3. javascript中的冒泡排序
  4. OpenLDAP安装
  5. 关于mvc ajax (post提交)——页面传值以及后台接收
  6. vb---输入模式之文本输入与二进制输入区别
  7. java 15 -3 集合的遍历的练习
  8. 281. Zigzag Iterator
  9. poj 1581 A Contesting Decision
  10. PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题
  11. POJ 2185 Milking Grid(KMP)
  12. I.MX6 android 移除shutdown功能
  13. Java常用API解析——序列化API
  14. asp.net web api 文件上传
  15. Python调用ansible API系列(三)带有callback的执行adhoc和playbook
  16. java 11 实现RFC7539中指定的ChaCha20和Poly1305两种加密算法, 代替RC4
  17. php用PDO查询mysql数据库结果中文乱码
  18. VS2015应用NuGet
  19. Hankson 的趣味题
  20. mysql中engine=innodb和engine=myisam的区别(转)

热门文章

  1. django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: rest_framework_swagger
  2. JavaScript:严格模式"use strict"
  3. texlive编译lshort-zh-cn
  4. $_GET方法踩坑
  5. 12、HSSFWorkbook实现多张sheet导出
  6. 还原火山引擎 A/B 测试产品——DataTester 私有化部署实践经验
  7. 分享自己亲测过的Visualstudio 2019中开发Typescript时,设置自动编译生成js,无需手工运行命令生成的方法。
  8. [MySQL] 索引的使用、SQL语句优化策略
  9. Coolify系列-手把手教学解决局域网局域网中的其他主机访问虚拟机以及docker服务
  10. 前端必备基础知识之--------原生JS发送Ajax请求