gpt4 book ai didi

apache - 无法连接到本地主机 :8080 with Vagrant and Ubuntu

转载 作者:太空宇宙 更新时间:2023-11-03 16:49:47 24 4
gpt4 key购买 nike

我尝试在 mac os 10.9.4 上安装 Vagrant 和 Ubuntu,按照@fideloper 的这个重要说明制作本地开发服务器:Vagrant and Apache .

Vagrantfile 包含:

config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.synced_folder ".", "/var/www/html"

evreything 在此过程中运行良好:安装了 Vagrant 和 virtualbox,在客户机上安装了 Apache。

来自 this answer ,我试过:

  • 在客户机上,curl 'http://localhost:80' 返回带有文件列表的 html
  • 在主机上,curl -v 'http://localhost:8080' 返回同一页。

但浏览器显示 此网页在 localhost:8080 不可用

为什么浏览器不显示 localhost:8080?

最佳答案

设置:

config.vm.synced_folder ".", "/var/www/html"

将用主机的 "." 目录(共享目录)中的内容覆盖服务器的 /var/www/html 目录中的内容。

/var/www/html/index.html 不再有 Apache 的默认 index.html 文件,因为您将共享目录安装在 Vagrant synced_folder 中的该位置设置。

根据您的说法,它完全正常工作,您只需开始将自己的 .html 文件添加到共享文件夹中即可!您只是在共享目录中没有要提供的 .html 文件,因此 Apache 回退到显示那里的文件索引。

关于apache - 无法连接到本地主机 :8080 with Vagrant and Ubuntu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24983316/

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