【发布时间】:2015-01-02 03:41:55
【问题描述】:
我尝试在 apache 上为 laravel 上的项目配置虚拟主机。为此,我在 /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
我的配置过程哪里出错了?
【问题讨论】:
-
laravel 安装在哪里?能否给出
public文件夹的完整路径? -
有时候需要重启apache
sudo service apache2 restart