我尝试在使用Docker时为yii2高级应用程序配置VirtualHost。这是一个vhost.conf:
<VirtualHost *:80>
ServerName frontend.test
DocumentRoot /app/frontend/web/
<Directory "/app/frontend/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName backend.test
DocumentRoot /app/backend/web/
<Directory "/app/backend/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
对于url localhost:8000,我得到站点的前端应用程序,ServerName frontend.test对我不起作用。有人可以解释一下如何正确配置此文件吗?以及如何获得后端应用程序?