我尝试在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
我的配置过程中哪里出错?
答案 0 :(得分:0)
您的app.conf
应编辑为:
DocumentRoot /var/www/html/app/public/app/public
您似乎在/var/www/html/app/public/app
<强>更新强>
您可能将默认网站的DocumentRoot
设置为/var/www/html
。如果是这种情况,那么请:
安装laravel:
/var/www/app
将DocumentRoot
定义为:
/var/www/app/public
重启apache
sudo service apache2 restart