此apache2.4和laravel设置的适当虚拟主机是什么?

时间:2016-01-13 00:52:01

标签: php apache laravel vhosts

我有一个内部网站,我致电eaglets。我用它来托管一堆javascript计算器等。我想使用laravel应用程序,地址看起来像http://eaglets/playground

我的var/www/html目录中有playground文件夹,这是我的默认文档根目录。

如果我在我的index.html文件夹中放入一个虚拟var/www/html/playground/并转到http://eaglets/playground,它就可以了。这让我相信我的虚拟主机没有正确指向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"

1 个答案:

答案 0 :(得分:0)

我有相同的用例,这里是配置(名称和路径改为你的):

<VirtualHost *:80>
    ServerName eaglets
    Alias /playground /var/www/html/playground/public

    <Directory /var/www/html/playground/public>
        Options FollowSymLinks
        AllowOverride All
    </Directory>
</VirtualHost>