Accessing apache on a vagrant sandbox using ssl (port forwarding)

前端 未结 2 747
太阳男子
太阳男子 2021-02-01 23:53

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 te

2条回答
  •  半阙折子戏
    2021-02-02 00:04

    1) Configure the file 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) Access your VM "lucid32"

    vagrant ssh
    

    3) Inside your VM, configure the Apache "Virtual Host":

    
        ServerName        your-domain.dev
        DocumentRoot    /vagrant
        DirectoryIndex    index.php index.html index.htm
    
        
            AllowOverride All
            Allow from All
        
    
    
    
        ServerName        your-domain.dev
        DocumentRoot    /vagrant
        DirectoryIndex    index.php index.html index.htm
    
        
            AllowOverride All
            Allow from All
        
    
        SSLEngine on
        SSLCertificateFile /path/to/certicate/apache.pem
    
    

    4) Exit VM and configure the file "hosts" in your host machine:

    33.33.33.10    your-domain.dev
    

提交回复
热议问题