標籤:部分 使用 rgs 網域名稱 配置 ups 相關 one header
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/
:成功
ThinkPHP5.0相關