gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 18:52:19 24 4
gpt4 key购买 nike

我试图在 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/    
laravel/
project/
site/

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

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

最佳答案

您的 app.conf应编辑为:

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

看来您在 /var/www/html/app/public/app 中安装了 laravel

更新

您可能有默认站点的 DocumentRoot设置为 /var/www/html .如果是这种情况,那么请:
  • 在以下位置安装 laravel:
    /var/www/app
  • 定义它是DocumentRoot作为:
    /var/www/app/public
  • 重启 Apache
    sudo service apache2 restart
  • 关于apache - 无法在 apache ubuntu 中配置虚拟主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26765825/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com