【问题标题】:What is the appropriate virtual host for this apache2.4 and laravel setup?这个 apache2.4 和 laravel 设置合适的虚拟主机是什么?
【发布时间】:2016-04-17 19:56:21
【问题描述】:

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

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

如果我在我的var/www/html/playground/ 文件夹中放置一个虚拟的index.html 并转到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"

【问题讨论】:

    标签: php apache laravel vhosts


    【解决方案1】:

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

    <VirtualHost *:80>
        ServerName eaglets
        Alias /playground /var/www/html/playground/public
    
        <Directory /var/www/html/playground/public>
            Options FollowSymLinks
            AllowOverride All
        </Directory>
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 2018-10-16
      • 2014-02-15
      • 2013-11-17
      • 1970-01-01
      • 1970-01-01
      • 2014-12-18
      • 1970-01-01
      • 2015-10-06
      • 1970-01-01
      相关资源
      最近更新 更多