yii2的下载安装

1.直接使用归档文件安装yii2的高级模板:

从 yiiframework.com 下载归档文件。

下载yii2的高级模板的压缩文件,

将yii-advanced-app-2.0.12文件夹复制到项目的目录中如下:

查看yii-advanced-app-2.0.12的子集目录发现有backend和frontend,backend为后台项目, frontend为 前台项目:

配置后台项目和前台的项目web服务如下:

这是后台项目backend的nginx配置:

server {
root D:/test/yii2_test/yii-advanced-app-2.0.12/advanced/backend/web/;
index index.php index.html;
server_name dev.yii2_backend.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;
}
}

这是前台项目frontend的nginx配置:

server {
root D:/test/yii2_test/yii-advanced-app-2.0.12/advanced/frontend/web/;
index index.php index.html;
server_name dev.yii2_frontend.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;
}
}

配置hosts文件如下:

127.0.0.1 dev.yii2_backend.com
127.0.0.1 dev.yii2_frontend.com

通过dev.yii2_backend.com访问后台项目:

通过dev.yii2_frontend.com访问前台项目如下:

2. 使用归档文件安装yii2的普通模板

下载yii2的普通模板如下:

复制普通模板文件到项目目录:

查看该项目子集目录列表:

在该项目的配置文件中设置cookieValidationKey:

在config/web.php文件中设置cookieValidationKey为true

为该项目配置nginx:

server {
root D:/test/yii2_test/yii-basic-app-2.0.11/basic/web/;
index index.php index.html;
server_name dev.yii2_basic.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;
}
}

配置hosts文件:

127.0.0.1 dev.yii2_backend.com
127.0.0.1 dev.yii2_frontend.com
127.0.0.1 dev.yii2_basic.com

重启nginx:

nginx -s reload

通过dev.yii2_basic.com访问yii2普通模板项目:

时间: 2024-08-09 02:03:58

yii2的下载安装的相关文章

YII2框架的安装

之前yii是直接下载的,给cookieValidationKey的值既可以用了,就没在意在线安装的形式.后来发现有些扩展什么的安装配置不好弄. 所以官网推荐composer来安装,只需执行一条简单的命令就可以安装新的扩展或更新 Yii 了. 在网上看了很多人都倒在了这个安装上面,但是安装貌似也不难.总是些菜鸟在上面自己提问题自己回答的,问百度被误导了好多次,哎. 1.下载安装composer 一般人做项目还是在windows操作系统上,所以记录的是windows版本的安装. 条件1:电脑上有ph

yii2如何环境部署?yii2高级模版安装教程

使用 Composer安装: 1.设置php环境变量: 在环境变量中classpash或者用户变量中path 后面追加添加php.exe目录地址: 这样cmd中执行php即可找到php.exe 2.安装Composer : 使用安装程序 这是将 Composer 安装在你机器上的最简单的方法. 下载并且运行 Composer-Setup.exe( https://getcomposer.org/Composer-Setup.exe),它将安装最新版本的 Composer ,并设置好系统的环境变量

Xcode5.1离线下载安装及使用iOS5模拟器进行开发调试的方法

Xcode5.1默认不支持iOS5版本的模拟器开发调试,在OS X Mavericks(10.9.x)下默认只能支持iOS6.1及以上版本的模拟器,在OS X Mountain Lion(10.8.x)下默认只能支持iOS6.0及以上版本的模拟器进行开发和调试,在此条件之下的版本只能使用硬件设备进行开发调试.虽然现在低版本的iOS设备越来越少了,但是有时客户的需求可能会要求我们一定要兼容iOS5(或更低版本)及以上版本,如果我们手头找不到低版本硬件设备用于调试或者完全使用硬件设备而没有对应的模拟

Visual Studio for Mac Preview离线下载安装

Visual Studio for Mac离线下载安装. 环境:OS X EI Caption 10.11.2 .NET Core SDK 1.1 需预先安装 .NET Core 1.1 SDK macOS版下载地址:https://go.microsoft.com/fwlink/?LinkID=835011 安装SDK需先安装openssl. brew update brew install openssl mkdir -p /usr/local/lib ln -s /usr/local/op

Android SDK在线下载安装问题--**Image项总是安装错误

这几天,重新进行Android环境配置,在线下载并安装Android SDK时,别的项目均可正确安装,但是全部或部分的**Image项安装不成功,不论是改hosts文件,还是修改option项中的相关设置均不成功. 从实际操作感觉来看**Image项和安装顺序有关.如果选择全部未安装上的**Image项,进行Accept后,总归失败:但是一项项按照顺序进行Accept下载安装,便可以成功,即需要一个一个Download & install.

如何将yum下载安装的包存起来,留着以后用

1.首先,yum下载安装软件时,那些软件包缓存位置为: /var/cache/yum 2.修改yum的配置文件: # vi /etc/yum.conf 会看到头三行代码为 [main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 将这里的值更改为1 OK,接下来用yum安装东西后,你可以从/var/cache/yum目录下找到并把自己安装的软件包保存备用了, 3.另外: yumdownloader --resolve --d

Windows下openssl的下载安装和使用

Windows下openssl的下载安装和使用 安装openssl有两种方式,第一种直接下载安装包,装上就可运行:第二种可以自己下载源码,自己编译.下面对两种方式均进行详细描述. 一.下载和安装openss 方法一:直接使用openssl安装包 Window 的openssl的安装包的下载地址为: http://slproweb.com/products/Win32OpenSSL.html 一般在安装openssl之前还需要vs的一些插件,该地址中也提供了相关插件的下载.如下图即为openssl

[视频讲解]Java(JDK的下载安装及第一个程序运行)

(JDK的下载安装及第一个程序运行) 内容:Java JDK 的安装以及HelloWorld 程序的运行 欢迎童鞋们前往围观 http://v.youku.com/v_show/id_XODA3MzkzNzMy.html 更多内容分享请关注 我的博客 http://www.xiaozhangwx.com 本视频由 小张网校 提供

centos7下载安装谷歌浏览器

centos7安装完成结束后,发现自带的火狐浏览器不太习惯,自己还是习惯谷歌浏览器,因为是新手嘛,所以自己就各种找教程看如何下载安装谷歌浏览器,一个一个按照教程试验,终于最后试验成功了一个,亲测可用. 首先,打开火狐浏览器,输入网址:http://chrome.richardlloyd.org.uk/install_chrome.sh 输入后,调转的过程中会跳出这样的界面: 选择打开方式gedit,点击确定开始下载install_chrome.sh文件,网速好的会直接下载完成弹出gedit编辑器