首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用迷航坞提供程序查看Nginx默认页面?

如何使用迷航坞提供程序查看Nginx默认页面?
EN

Stack Overflow用户
提问于 2015-05-03 07:39:22
回答 1查看 961关注 0票数 1

我尝试使用流浪汉码头提供商运行我的Nginx服务器,例如:

代码语言:javascript
复制
vagrant up

Vagrantfile指令如下:

代码语言:javascript
复制
# Specify Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'

# Create and configure the Docker container(s)
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.network "private_network", ip: "192.168.66.66"

  config.vm.provider "docker" do |docker|
    docker.name = 'nginx-container'
    docker.image = "nginx:latest"
    docker.ports = ['80:80', '443:443']
  end
end

如果我用vagrant status检查流浪者的身份,我会得到:

代码语言:javascript
复制
Current machine states:

default                   running (docker)

The container is created and running. You can stop it using
`vagrant halt`, see logs with `vagrant docker-logs`, and
kill/destroy it with `vagrant destroy`.

当我尝试获得http://192.168.66.66/页面时,我得到了ERR_CONNECTION_TIMED_OUT,而页面没有加载。为什么我没有看到Nginx默认网页?

控制台中vagrant up期间的日志如下:

代码语言:javascript
复制
==> default: Docker host is required. One will be created if necessary...
    default: Docker host VM is already ready.
==> default: Syncing folders to the host VM...
    default: Installing rsync to the VM...
    default: Rsyncing folder: /Users/victor/www/symfony/ => /var/lib/docker/docker_1430638235_29519
==> default: Warning: When using a remote Docker host, forwarded ports will NOT be
==> default: immediately available on your machine. They will still be forwarded on
==> default: the remote machine, however, so if you have a way to access the remote
==> default: machine, then you should be able to access those ports there. This is
==> default: not an error, it is only an informational message.
==> default: Creating the container...
    default:   Name: nginx-container
    default:  Image: nginx:latest
    default: Volume: /var/lib/docker/docker_1430638235_29519:/vagrant
    default:   Port: 80:80
    default:   Port: 443:443
    default:
    default: Container created: b798ea3309612fb2
==> default: Starting container...
==> default: Provisioners will not be run since container doesn't support SSH.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-04 19:12:27

这是几个月前的事了,但为了其他可能来到这里的人,我还是会回答的:

使用docker ps查看您的图像标识符,应该是“b798ea3309612fb2”

然后做:

代码语言:javascript
复制
docker inspect b798ea3309612fb2 | grep IPAddress

所以你要确认IP地址。

因为您公开了端口,所以您应该可以在真实的IP中看到它们(无论您使用哪个容器用于Vagrant)。确保没有防火墙阻挡他们。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30011401

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档