我有一个内部站点,我称之为eaglets
。我用它来托管一堆javascript计算器等等。我想使用一个laravel应用程序,并使地址看起来像http://eaglets/playground
。
我的var/www/html
目录中有一个游乐场文件夹,它是我默认的文档根目录。
如果我把一个伪index.html
放在我的var/www/html/playground/
文件夹中,然后转到http://eaglets/playground
,结果会很好。这让我相信我的vhost没有正确指向var/www/html/playground/public
文件夹。
这是我的虚拟主机文件:
1 <VirtualHost *:80>
2
3 ServerName eaglets/playground
4 ServerAlias eaglets/playground
5 DocumentRoot /var/www/html/playground/public
6 <Directory /var/www/html/playground/public>
7 Options -Indexes +FollowSymLinks +MultiViews
8 AllowOverride All
9 Require all granted
10 </Directory>
11
12 ErrorLog ${APACHE_LOG_DIR}/playground-error.log
13 CustomLog ${APACHE_LOG_DIR}/playground-access.log combined
14
15 </VirtualHost>
有什么想法吗?
如果我做apachectl-S我得到:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server eaglets (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost eaglets (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost eaglets/playground (/etc/apache2/sites-enabled/playground.conf:1)
alias eaglets/playground
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
我有相同的用例,这里是配置(名称和路径更改为您的):
<VirtualHost *:80>
ServerName eaglets
Alias /playground /var/www/html/playground/public
<Directory /var/www/html/playground/public>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>