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框架的下载安装图文教程的详细内容。更多信息请关注PHP中文网其他相关文章!

win11安装语言包错误0x800f0950什么原因?当我们在给windows11系统安装新语言包时,有时会遇到系统提示错误代码:0x800f0950,导致语言包安装流程无法继续进行下去。导致这个错误代码一般是什么原因,又要怎么解决呢?今天小编就来给大家说明一下win11安装语言包错误0x800f0950的具体解决步骤,有需要的用户们赶紧来看一下吧。win11电脑错误代码0x800f0950解决技巧1、首先按下快捷键“Win+R”打开运行,然后输入:Regedit打开注册表。2、在搜索框中输入“

GoogleDocs在学校和工作环境中变得很流行,因为它提供了文字处理器所期望的所有功能。使用Google文档,您可以创建文档、简历和项目提案,还可以与世界各地的其他用户同时工作。您可能会注意到GoogleDocs不包括MicrosoftWord附带的所有功能,但它提供了自定义文档的能力。使用正确的字体可以改变文档的外观并使其具有吸引力。GoogleDocs提供了大量字体,您可以根据自己的喜好从中选择任何人。如果您希望将自定义字体添加到Google文档,请继续阅读本文。在本文中

Notepad++主要由开发人员用于编辑源代码,由临时用户用于编辑文本。但是,如果您刚刚升级到Windows11,则在您的系统上下载和安装该应用程序可能具有挑战性。因此,我们将讨论在Windows11上下载和安装记事本++。此外,您可以轻松阅读我们关于修复Notepad++在Windows上没有响应的详细指南。记事本++可以在Windows11上运行吗?是的,记事本++可以在Windows11上有效工作,而不会出现兼容性问题。更具体地说,没有臃肿的选项或错误,只需在一个非常小的编辑器中即可。此外

Steam客户端无法识别您计算机上的任何游戏吗?当您从计算机上卸载Steam客户端时,会发生这种情况。但是,当您重新安装Steam应用程序时,它会自动识别已安装文件夹中的游戏。但是,别担心。不,您不必重新下载计算机上的所有游戏。有一些基本和一些高级解决方案可用。修复1–尝试在同一位置安装游戏这是解决这个问题的最简单方法。只需打开Steam应用程序并尝试在同一位置安装游戏即可。步骤1–在您的系统上打开Steam客户端。步骤2–直接进入“库”以查找您拥有的所有游戏。第3步–选择游戏。它将列在“未分类

<p><strong>HaloInfinite(Campaign)</strong>是一款第一人称射击视频游戏,于2021年11月推出,可供单人和多用户使用。该游戏是Halo系列的延续,适用于Windows、XboxOne和Xbox系列的用户X|S。最近,它还在PC版XboxGamePass上发布,以提高其可访问性。大量玩家报告在尝试使用WindowsPC上的<strong>Xbox应

我们深知MicrosoftWindows11是一个功能齐全且设计吸引人的操作系统。但是,用户一直要求Windows11Lite版本。尽管它提供了重大改进,但Windows11是一个资源匮乏的操作系统,它可能很快就会使旧机器混乱到无法顺利运行的地步。本文将解决您最常问的关于是否有Windows11Lite版本以及是否可以安全下载的问题。跟着!有Windows11Lite版本吗?我们正在谈论的Windows11Lite21H2版本是由Neelkalpa的T

虚拟机怎么安装Win11?近期有用户想要尝试使用VirtualBox虚拟机安装Win11,但是不太清楚具体的操作方法,针对这一情况,小编将为大家演示使用VirtualBox安装Win11的方法,很多小伙伴不知道怎么详细操作,小编下面整理了使用VirtualBox安装Win11的步骤,如果你感兴趣的话,跟着小编一起往下看看吧! 使用VirtualBox安装Win11的步骤 1、要下载VirtualBox,请前往VirtualBox官方下载页面,下载适用于Windows的.exe文件。如果你

<p><strong>邮件应用程序</strong>是Windows11内置的一个非常有用的电子邮件客户端。它允许您从一个位置管理所有邮件帐户。虽然Mail应用程序非常有用,但有时可能需要重置,有时也需要重新安装,原因有多种。在本文中,我们将通过一些简单的步骤说明如何从Windows11轻松卸载Mail应用程序,以及如何轻松地从MicrosoftStore将其取回。</p>&l


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

SublimeText3 Linux新版
SublimeText3 Linux最新版

SublimeText3汉化版
中文版,非常好用

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)