访问无业游民的沙箱上的apache

访问无业游民的沙箱上的apache

本文介绍了使用ssl(端口转发)访问无业游民的沙箱上的apache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个vagrant/virtualbox Web服务器作为开发沙箱,并在VM中为ssl(在具有自签名证书的默认端口443上)配置了apache.我已经使用curl

I've built a vagrant/virtualbox web server as a development sandbox, and configured apache in the VM for ssl (on the default port 443, with a self-signed certificate). I've tested pages on the VM itself using curl

curl -v -k https://mysite.mydomain.com/testSearch/results?postcode=WN8+0BA

它似乎工作得很愉快,所以我对apache的配置正确并在VM中正常工作感到满意.

and it seems to work quite happily, so I'm satisfied that apache is correctly configured and working in the VM.

但是,当我尝试通过https从主机的浏览器访问VM时,我无法这样做.

However, when I try to access the VM from my host's browsers over https, I'm unable to do so.

我添加了

config.vm.forward_port "https", 443, 8443

到我的vagrantfile,但尝试访问url

to my vagrantfile, but trying to access the url

https://mysite.mydomain.com:8443/testSearch/results?postcode=WN8+0BA

根本无法显示我在几种不同的浏览器上尝试过的页面:IE给出了毫无意义的"Internet Explorer无法显示该网页"; Chrome提供了

simply can't display the page I've tried with several different browsers: IE gives a meaningless "Internet Explorer cannot display the webpage"; Chrome gives

SSL connection error
Unable to make a secure connection to the server. This may be a problem with the server or it may be requiring a client authentication certificate that you don't have.
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.

Firefox给了我

Firefox gives me

An error occurred during a connection to mysite.mydomain.com:8443.
SSL received a record that exceeded the maximum permissible length.
(Error code: ssl_error_rx_record_too_long)

但是,即使Firebug的"Net"选项卡也没有告诉我更多信息.

but even the Firebug Net tab doesn't tell me anything more than that.

我在VM apache的访问或错误日志中什么都没得到,所以我怀疑流浪汉根本没有转发ssl.

I'm not getting anything in the access or error logs on the VM apache, so I suspect that vagrant isn't forwarding the ssl at all.

  • VM Guest操作系统:centos56x64
  • 主机:Windows 7 64位
  • JRuby:1.6.3(ruby-1.8.7-p330)(2011-07-07 965162f)(Java HotSpot(TM)64位服务器VM 1.6.0_24)[Windows 7-amd64-java]
  • 游民:0.7.8
  • VirtualBox:4.0.12

我们将不胜感激地接受任何帮助.

Any assistance would be gratefully accepted.

推荐答案

1)配置文件Vagrantfile

Vagrant::Config.run do |config|
    config.vm.box = "lucid32"
    config.vm.network "33.33.33.10"
    config.vm.forward_port "http", 80, 8080
end

2)访问您的虚拟机"lucid32"

vagrant ssh

3)在VM内,配置Apache虚拟主机":

<VirtualHost 33.33.33.10:80>
    ServerName        your-domain.dev
    DocumentRoot    /vagrant
    DirectoryIndex    index.php index.html index.htm

    <Directory /vagrant>
        AllowOverride All
        Allow from All
    </Directory>
</VirtualHost>

<VirtualHost 33.33.33.10:443>
    ServerName        your-domain.dev
    DocumentRoot    /vagrant
    DirectoryIndex    index.php index.html index.htm

    <Directory /vagrant>
        AllowOverride All
        Allow from All
    </Directory>

    SSLEngine on
    SSLCertificateFile /path/to/certicate/apache.pem
</VirtualHost>

4)退出VM并在主机中配置文件主机":

33.33.33.10    your-domain.dev

这篇关于使用ssl(端口转发)访问无业游民的沙箱上的apache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 21:21