无法在apache ubuntu中配置虚拟主机

时间:2014-11-05 19:51:05

标签: apache ubuntu laravel

我尝试在laache上为项目配置虚拟主机。为此,我在/etc/apache2/sites-available/app.conf中创建了文件:

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  ServerName app
  DocumentRoot /var/www/html/app/public
  <Directory />
    Options All
    AllowOverride All
  </Directory>
  <Directory /var/www/html/app/public>
    Options All
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
  ErrorLog /var/log/apache2/error.log
  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn
  CustomLog /var/log/apache2/access.log combined
  ServerSignature On
</VirtualHost>

然后我激活了主持人:

sudo a2ensite app.conf

并在终端中留言:

Enabling site app.
To activate the new configuration, you need to run:
  service apache2 reload

然后我重装

我也修改了'/ etc / hosts':

127.0.1.1   Alexandra
127.0.0.1   app

所以,现在当我在浏览器中继续 app / 时,它会显示项目的文件夹:

索引/

app/    
laravel/    
project/    
site/   

现在,如果我想显示“欢迎页面”,我应该去app / app / public

我的配置过程中哪里出错?

1 个答案:

答案 0 :(得分:0)

您的app.conf应编辑为:

DocumentRoot /var/www/html/app/public/app/public

您似乎在/var/www/html/app/public/app

中安装了laravel

<强>更新

您可能将默认网站的DocumentRoot设置为/var/www/html。如果是这种情况,那么请:

  1. 安装laravel:

    /var/www/app

  2. DocumentRoot定义为:

    /var/www/app/public

  3. 重启apache

    sudo service apache2 restart

相关问题