2011-08-12 15 views
13

私は、開発サンドボックスとして障害のある/仮想のWebサーバーを構築し、sslのVMにapacheを構成しました(デフォルトのポート443では、証明書)。私はカールssl(ポート転送)を使用して迷惑メールサンドボックスにアクセスする

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

を使用してVM自体のページをテストしてみたし、非常に喜んで動作しているようですので、私は、Apacheが正しく設定されていることを満足していると、VMに取り組んでいます。

しかし、httpsでホストのブラウザからVMにアクセスしようとすると、私はそれを行うことができません。 IEが与える:私は私のvagrantfileに

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

を追加しましたが、URL単に

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

私はいくつかの異なるブラウザで試してみたページを表示することはできませんにアクセスしようとしてきました

無意味な "Internet Explorerはウェブページを表示できません"。 ChromeはFirefoxが私に

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のネットタブが私にそれ以上は何も教えてくれない

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. 

を与えます。

VMのApacheのアクセスログまたはエラーログに何も表示されないため、私は、迷惑メールプログラムがsslをまったく転送していないと考えています。

  • VMゲストOS:centos56x64
  • ホスト:Windows 7の64ビット
  • JRubyの:1.6.3(ルビー-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

どのような援助を感謝して受け入れられます。

答えて

24

1)Apacheの "仮想ホスト" を設定し、あなたのVMの内部であなたのVM "lucid32"

vagrant ssh 

)にアクセスし)ファイル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 

を設定:

<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 
+6

このソリューションを使用する場合は、バグのボックスを破棄するときに2と3のステップを繰り返し実行する必要があります。プロビジョニング(bash)スクリプトを使用することで、シェフやパペットはこの作業を大幅に少なくします。 –

+1

googlerのためには、 '.crt'ファイルに' SSLCertificateFile'を、 '.key'ファイルに' SSLCertificateKeyFile'の両方を指定しなければなりませんでした。 –

0

答えは、上記の手順2と3を使用すると、ボックスを破壊するたびに繰り返し続けるためにあなたを必要とします。シェフを使って目標を達成することをお勧めします。以下の例を参照してください。

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

Vagrant.configure(2) do |config| 

    config.vm.box  = "precise64" 
    config.vm.box_url = "http://files.vagrantup.com/precise64.box" 

    config.vm.network :forwarded_port, guest: 80, host: 8080 
    config.vm.network :forwarded_port, guest: 443, host: 443 

    config.vm.network "private_network", ip: "192.168.33.10" 

    config.vm.provision :chef_solo do |chef| 

     chef.cookbooks_path = "/path/to/your/cookbooks" 

     # Install PHP 
     chef.add_recipe "php" 
     chef.add_recipe "php::module_mysql" 

     # Setup Apache 
     chef.add_recipe "apache2" 
     chef.add_recipe "apache2::mod_php5" 

     chef.json = { :apache => { :default_site_enabled => true } } 

    end 

end 
関連する問題