【问题标题】:How to share a vagrant machine with https如何与 https 共享 vagrant 机器
【发布时间】:2017-06-17 00:16:32
【问题描述】:

我有一个正在工作的流浪虚拟机,我想Share。在我的 Vagrantfile 中,我有:

config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "private_network", ip: "192.168.1.15"
config.vm.network "forwarded_port", guest: 443, host: 443

在我拥有的虚拟主机中

<VirtualHost *:443>
...
ServerAlias *.vagrantshare.com
....
</Virtualhost>

不确定第一行,但它已经在那里了

我与

共享机器
vagrant share --https 443

这是输出:

==> default: Detecting network information for machine...
default: Local machine address: 127.0.0.1
default:  
default: Note: With the local address (127.0.0.1), Vagrant Share can only
default: share any ports you have forwarded. Assign an IP or address to your
default: machine to expose all TCP ports. Consult the documentation
default: for your provider ('virtualbox') for more information.
default:  
default: Local HTTP port: 8080
default: Local HTTPS port: 443
default: Port: 2222
default: Port: 443
default: Port: 8080
==> default: Checking authentication and authorization...
==> default: Creating Vagrant Share session...
default: Share will be at: towering-badger-9312
==> default: Your Vagrant Share is running! Name: towering-badger-9312
==> default: URL: http://towering-badger-9312.vagrantshare.com
==> default:  
==> default: You're sharing your Vagrant machine in "restricted" mode. This
==> default: means that only the ports listed above will be accessible by
==> default: other users (either via the web URL or using `vagrant connect`).

我可以在 vagrant cloud 中看到它,但尝试通过 https 访问它时出错:

towering-badger-9312.vagrantshare.com is currently unable to handle this request.
HTTP ERROR 500

控制台中没有任何其他有用的消息,知道如何调试吗?

谢谢

【问题讨论】:

    标签: vagrant virtual-machine vagrantfile vagrant-share


    【解决方案1】:

    替换此行

    config.vm.network "forwarded_port", guest: 443, host: 443
    

    与即

    config.vm.network "forwarded_port", guest: 443, host: 8443
    

    首先,因为forwarded_port 用于从您的主机访问,其次,您应该无法绑定到主机上的端口 443。

    还有

    vagrant share --https 443
    

    是多余的(docs):

    HTTPS (SSL)

    Vagrant Share 还可以公开一个 SSL 端口,该端口可以通过 SSL。例如,不是访问http://foo.vagrantshare.com,而是 可以通过https://foo.vagrantshare.com访问。

    vagrant share 默认在你的 443 端口上查找任何 SSL 流量 开发环境。如果找不到,则 SSL 被禁用 默认情况下。

    所以

    vagrant share
    

    应该足够了(假设没有其他问题)。

    【讨论】:

    • 我试过了,但分享时我得到“默认:本地 HTTPS 端口:禁用”。在我的 443 客人上有 apache,并且从我的主机上它可以工作。还有其他想法吗?谢谢。
    • 现在共享时我得到默认值:本地 HTTP 端口:8080 默认值:本地 HTTPS 端口:8443 http 有效,但 https 现在显示错误 400
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-03
    • 1970-01-01
    • 2016-11-26
    • 1970-01-01
    • 2019-06-13
    • 1970-01-01
    相关资源
    最近更新 更多