首页 / PHP / yii2框架的下载安装图文教程
yii2框架的下载安装图文教程
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了yii2框架的下载安装图文教程,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5232字,纯文字阅读大概需要8分钟。
内容图文
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普通模板项目:
以上就是yii2框架的下载安装图文教程的详细内容,更多请关注Gxl网其它相关文章!
内容总结
以上是互联网集市为您收集整理的yii2框架的下载安装图文教程全部内容,希望文章能够帮你解决yii2框架的下载安装图文教程所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。