1.根据官方文档,下载tp5最新代码地址 https://www.kancloud.cn/manual/thinkphp5/118003步骤:(使用git安装)①首先克隆下载应用项目仓库git clone https://github.com/top-think/think tp5②然后切换到tp5目...
1.根据官方文档,下载tp5最新代码
地址 https://www.kancloud.cn/manual/thinkphp5/118003
步骤:(使用git安装)
①首先克隆下载应用项目仓库
git clone https://github.com/top-think/think tp5
②然后切换到tp5目录下面,再克隆核心框架仓库:
git pull https://github.com/top-think/framework
③验证是否安装成功,在浏览器中输入地址
http://localhost/tp5/public/
这时,浏览器中不知道你输入的地址指向的是谁,在nginx服务器下配置相应的配置文件,给项目独立的端口并指向相应地址,在conf.d文件中新建XXX.conf文件
server {
listen 8801;
server_name localhost;
root D:/tp/myProject/tp5/public;
index index.php index.html index.htm;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
location / {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?s=/$1 last;
}
}
location = /favicon.ico { access_log off; log_not_found off; }
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root D:/tp/myProject/tp5/public;
}
#
location ~ \.php$ {
root D:/tp/myProject/tp5/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
在浏览者输入localhost:8801,会成功出现成功内容
Nginx支持TP5pathinfo路由规则
1 location / {
2 if (!-e $request_filename){
3 rewrite ^/(.*)$ /index.php?s=/$1 last;
4 }
5 }
可以在浏览器中输入http://localhost:8801/index/index/hello。使用pathinfo方式访问控制器/类/方法
未配置pathinfo时,在浏览器中输入?s=/index/index/hello 来访问相应方法。
本文标题为:nginx配置thinkphp5
- 用nohup命令实现PHP的多进程 2023-09-02
- windows下9款一键快速搭建PHP本地运行环境的好工具(含php7.0环境) 2023-09-02
- laravel通用化的CURD的实现 2023-03-17
- PHP简单实现二维数组的矩阵转置操作示例 2022-10-02
- PHP中PDO事务处理操作示例 2022-10-15
- Laravel balde模板文件中判断数据为空方法 2023-08-30
- laravel实现按月或天或小时统计mysql数据的方法 2023-02-22
- PHP实现微信支付(jsapi支付)流程步骤详解 2022-10-09
- PHP仿tp实现mvc框架基本设计思路与实现方法分析 2022-10-18
- php微信公众号开发之秒杀 2022-11-23
