我们在dist(var / www / dev / dist)文件夹中有一个VUE前端。我们成功设置了当用户访问dev.domain.com时它访问dist文件夹。我们遇到的问题是我们的api,它位于api子文件夹(var / www / dev / api / public)中。我们要完成的是当URL dev.domain.com/api被调用时,它指向/ var / www / dev / api / public,并且还将处理附加到api的所有请求(dev.domain.com/api/ *)。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
Servername dev.domain.com
ServerAlias dev.domain.com
Alias /api /var/www/dev/api/public
<Directory /var/www/dev/api>
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
DocumentRoot /var/www/dev/dist
<Directory "/var/www/dev">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/dev-domain.log
# Possible values include: debug, info, notice, warn, errot, crit
# alert, emerg.
LogLevel warn
Customlog ${APACHE_LOG_DIR}/dev-domain-access.log combined
</Virtualhost>
答案 0 :(得分:0)
经过上述评论的一些研究和帮助之后,我最终得到它以使用以下虚拟主机配置。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
Servername dev.domain.com
DocumentRoot /var/www/dev/dist/
<Directory "/var/www/dev/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Alias /api/ "/var/www/dev/api/public/"
<Directory "/var/www/dev/api/public/">
Options Indexes FollowSymLinks
</Directory>
ErrorLog ${APACHE_LOG_DIR}/dev-domain.log
# Possible values include: debug, info, notice, warn, errot, crit
# alert, emerg.
LogLevel warn
Customlog ${APACHE_LOG_DIR}/dev-domain-access.log combined
</Virtualhost>