tp6

tp6 think-swoole企业最佳实践手册

https://www.kancloud.cn/zhangqi/think-swoole/1730103

安装视图扩展

composer require topthink/think-view

安装swoole扩展

composer require topthink/think-swoole

 去除.php路径访问

  nginx.conf文件(有域名当加载的nginx.conf)

  1. location / {  
  2.         index  index.htm index.html index.php;  
  3.         #访问路径的文件不存在则重写URL转交给ThinkPHP处理  
  4.         if (!-e $request_filename) {  
  5.            rewrite  ^/(.*)$  /index.php/$1  last;  
  6.            break;  
  7.         }  
  8.     }  
  9.     location ~ \.php/?.*$ {  
  10.         root        /var/www/html/website;  
  11.         fastcgi_pass   127.0.0.1:9000;  
  12.         fastcgi_index  index.php;  
  13.         #加载Nginx默认"服务器环境变量"配置  
  14.         include        fastcgi.conf;  
  15.           
  16.         #设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量  
  17.         set $fastcgi_script_name2 $fastcgi_script_name;  
  18.         if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {  
  19.             set $fastcgi_script_name2 $1;  
  20.             set $path_info $2;  
  21.         }  
  22.         fastcgi_param   PATH_INFO $path_info;  
  23.         fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;  
  24.         fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;  
  25.     }  
posted @ 2024-02-09 14:06  祈愿仙帝  阅读(1)  评论(0编辑  收藏  举报