2011-08-12 4 views
13

방제/가상 박스 웹 서버를 개발 샌드 박스로 구축하고 ssl 용 VM에 아파치를 구성했습니다 (기본 포트 443에서 자체 서명 된 증명서). 나는 컬ssl (포트 포워딩)을 사용하여 미약 한 샌드 박스에 액세스하기

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

를 사용하여 VM 자체에 페이지를 테스트 한 아주 행복하게 작동하는 것 같다, 그래서 아파치를 올바르게 설정해서 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는 웹 페이지를 표시 할 수 없습니다"; 크롬은 파이어 폭스 나에게

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) 

을 제공하지만, 심지어 방화범 순 탭이 나에게 그 이상 아무것도 말하지 않는

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 아파치의 액세스 또는 오류 로그에 아무것도 표시되지 않으므로 방황하는 사람이 ssl을 전혀 전달하지 않는 것으로 의심됩니다.

  • VM 게스트 OS : centos56x64
  • 호스트 : 윈도우 7 64 비트
  • JRuby를 : 1.6.3 (루비 1.8.7-P330) (2011-07-07 965162f) (자바 핫스팟 (TM) 64 비트 서버 VM 1.6.0_24) [윈도우 7-AMD64-자바]
  • 방랑 : 0.7.8
  • 버추얼 : 4.0.12

모든 지원은 기꺼이 인정 될 것이다.

답변

24

1) 아파치 "가상 호스트"를 구성하여 VM 내부에 VM "lucid32"

vagrant ssh 

3

)에 액세스) 파일 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

구성 :

<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

이 솔루션을 사용하는 경우에는 Vagrant 상자를 파괴 할 때 2 단계와 3 단계를 반복해야합니다. 프로비저닝 (bash) 스크립트를 사용하여 Chef 또는 Puppet은이 작업을 훨씬 덜 반복적으로 수행합니다. –

+1

googler의 경우 'SSLCertificateFile'을'.crt' 파일에 지정하고 SSLCertificateKeyFile을'.key' 파일에 지정해야했습니다. –

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 
관련 문제