自定义前后端yii2.0
Customize frontend and backend yii2.0
我用yii2.0建立了一个网站。要打开网站的前端,我必须使用 localhost:8080/yii2/frontend/web/index.php 并打开后端,我正在使用 localhost:8080/ yii2/backend/web/index.php.
我的问题是如何打开前端网站 http://localhost:8080/yii2/
对于 localhost:8080/yii2/frontend/web/index.php.
并且对于后端,我如何打开像 http://localhost:8080/yii2/backend/ 这样的网站
localhost:8080/yii2/backend/web/index.php
您正在寻找这个https://github.com/yiisoft/yii2/blob/master/docs/guide/tutorial-shared-hosting.md
简而言之,您必须将 /web 文件夹移动到另一个地方并更改 index.php 和 index-test.php.
中的路径
1.you 可以使用 apache 或 nginx "use test.com" for localhost:8080/yii2/web/index.php
并将 "backend.test.com" 用于 localhost:8080/yii2/backend/web/index.php
这是 vhost.conf 在 apache
<VirtualHost *:80>
DocumentRoot "C:\phpstudy\www\yii_2\frontend\web"
ServerName dev.com
ServerAlias
<Directory "C:\phpstudy\www\yii_2\frontend\web">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\phpstudy\www\yii_2\backend\web"
ServerName api.dev.com
ServerAlias
<Directory "C:\phpstudy\www\yii_2\backend\web">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
我用yii2.0建立了一个网站。要打开网站的前端,我必须使用 localhost:8080/yii2/frontend/web/index.php 并打开后端,我正在使用 localhost:8080/ yii2/backend/web/index.php.
我的问题是如何打开前端网站 http://localhost:8080/yii2/ 对于 localhost:8080/yii2/frontend/web/index.php.
并且对于后端,我如何打开像 http://localhost:8080/yii2/backend/ 这样的网站 localhost:8080/yii2/backend/web/index.php
您正在寻找这个https://github.com/yiisoft/yii2/blob/master/docs/guide/tutorial-shared-hosting.md
简而言之,您必须将 /web 文件夹移动到另一个地方并更改 index.php 和 index-test.php.
中的路径1.you 可以使用 apache 或 nginx "use test.com" for localhost:8080/yii2/web/index.php
并将 "backend.test.com" 用于 localhost:8080/yii2/backend/web/index.php
这是 vhost.conf 在 apache
<VirtualHost *:80>
DocumentRoot "C:\phpstudy\www\yii_2\frontend\web"
ServerName dev.com
ServerAlias
<Directory "C:\phpstudy\www\yii_2\frontend\web">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\phpstudy\www\yii_2\backend\web"
ServerName api.dev.com
ServerAlias
<Directory "C:\phpstudy\www\yii_2\backend\web">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>