专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > php

ThinkPHP5.0有关

发布时间:2010-05-20 14:01:29 文章来源:www.iduyao.cn 采编人员:星星草
ThinkPHP5.0相关

1.tp5的下载安装

使用git克隆下面的仓库地址,这个地址下载的速度比较快,差不多两分钟的时间。

克隆tp5的应用项目:

git clone https://github.com/top-think/think tp5

该命令完成了从https服务器上克隆了一个think的web应用项目,并重命名为tp5

克隆tp5的框架程序包:

git clone https://github.com/top-think/framework thinkphp

该命令完成了从https服务器上克隆了一个框架程序包,并命名为thinkphp,如果不命名为thinkphp,web访问会报错,因为在tp5的应用程序里引用框架的目录为thinkphp

 

2.配置nginx服务器和hosts文件

server {
root D:/project/tp5/;
index index.php index.html;
server_name dev.tp5.com;
# set $yii_bootstrap "index.html";
set $yii_bootstrap "index.php";

charset utf-8;

location / {
index $yii_bootstrap;
try_files $uri $uri/ $yii_bootstrap?$args;
if (!-e $request_filename) {
rewrite (.*) /index.php/$1;
}
}

location ~ ^/(protected|framework|nbproject|themes/w+/views) {
deny all;
}

location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}

location ~ .*.(js|css)?$ {
expires 7d;
}

#avoid processing of calls to unexisting static files by yii
location ~ .(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {

fastcgi_split_path_info ^(.+.php)(.*)$;

#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}

#fastcgi_next_upstream error timeout invalid_header http_500 http_503 http_404;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;

#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;

}

location ~ /.ht {
deny all;
}
}

这段代码为在nginx.conf中配置了一个虚拟主机

127.0.0.1 dev.swzqclient.yingyongdaren.com
127.0.0.1 dev.swzqapi.yingyongdaren.com
127.0.0.1 dev.swzq.yingyongdaren.com
127.0.0.1 dev.bbs.nianyuapp.com
127.0.0.1 dev.tp5.com

又在hosts文件了配置了dev.tp5.com的域名访问的是本地主机

这两部分完成了:

dev.tp5.com映射到127.0.0.1这台计算机的D:/project/tp5/目录

 

3.启动nginx和php

start nginx

nginx -s reload

这段代码启动nginx服务器并重新加载nginx配置文件

 

4.访问http://dev.tp5.com/public/

如图所示:成功

 



友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: