1.TP5 Download and install
Using Git to clone the following warehouse address, this address download is faster, almost two minutes of time.
Applications for cloning TP5:
git clone https://github.com/top-think/think tp5
This command completes cloning a think Web application project from the HTTPS server and renaming it to TP5
Cloning the TP5 Framework package:
git clone https://github.com/top-think/framework thinkphp
The command completed cloning a framework package from the HTTPS server and named thinkphp, if not named Thinkphp,web access would be an error because the directory referencing the framework in TP5 's application is thinkphp
2. Configuring the Nginx server and Hosts file
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 is 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;
}
}
This code configures a virtual host in 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
Again in the Hosts file is configured with the dev.tp5.com domain name to access the local host
These two parts are completed:
dev.tp5.com map to 127.0.0.1 d:/project/tp5/directory for this computer
3. Start Nginx and PHP
Start Nginx
Nginx-s Reload
This code starts the Nginx server and reloads the Nginx configuration file.
4. Visit http://dev.tp5.com/public/
: Success
ThinkPHP5.0 related