我创建了一个使用yii2.0的网站。要打开网站的前端,我必须使用localhost:8080/yii2/frontend/web/index.php,为了打开后端,我使用localhost:8080/yii2/backend/web/index.php.
我的问题是如何像localhost:8080/yii2/frontend/web/index.php.的http://localhost:8080/yii2/一样为前端打开网站?
对于后端,我如何打开像localhost:8080/yii2/backend/web/index.php的http://localhost:8080/yii2/backend/这样的网站?
发布于 2015-01-27 06:36:06
你在找这个https://github.com/yiisoft/yii2/blob/master/docs/guide/tutorial-shared-hosting.md
简而言之,您必须将/web文件夹移到另一个位置,并更改index.php和index-test.php中的路径。
发布于 2015-04-09 04:07:10
1.您可以对localhost使用apache或nginx "use test.com“:8080/yii2 2/web/index.php
并使用"backend.test.com“作为本地主机:8080/yii2 2/后端/web/index.php
这是apache中的vhost.conf
<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>https://stackoverflow.com/questions/28164366
复制相似问题