Search code examples
apacheubuntuvagrantvhostspuphpet

Can't access my Vagrant's remote webserver


I just created a VM using phphpet.

Here is my config.yaml file: http://pastebin.com/7rGFYt5e

---
vagrantfile-local:
    vm:
        box: puphpet/ubuntu1404-x64
        box_url: puphpet/ubuntu1404-x64
        hostname: ''
        memory: '1024'
        cpus: '1'
        chosen_provider: virtualbox
        network:
            private_network: 192.168.56.102
            forwarded_port:
                9SkWleLVPU1f:
                    host: '9501'
                    guest: '22'
        post_up_message: ''
        provider:
            virtualbox:
                modifyvm:
                    natdnshostresolver1: on
            vmware:
                numvcpus: 1
            parallels:
                cpus: 1
        provision:
            puppet:
                manifests_path: puphpet/puppet
                manifest_file: site.pp
                module_path: puphpet/puppet/modules
                options:
                    - '--verbose'
                    - '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
                    - '--parser future'
        synced_folder:
            Sa0oKcy8QDqc:
                source: ./
                target: /var/www
                sync_type: nfs
                rsync:
                    args:
                        - '--verbose'
                        - '--archive'
                        - '-z'
                    exclude:
                        - .vagrant/
                    auto: 'false'
        usable_port_range:
            start: 10200
            stop: 10500
    ssh:
        host: null
        port: null
        private_key_path: null
        username: vagrant
        guest_port: null
        keep_alive: true
        forward_agent: false
        forward_x11: false
        shell: 'bash -l'
    vagrant:
        host: detect
server:
    install: '1'
    packages: {  }
firewall:
    install: '1'
    rules: null
apache:
    install: '1'
    settings:
        user: www-data
        group: www-data
        default_vhost: true
        manage_user: false
        manage_group: false
        sendfile: 0
    modules:
        - rewrite
        - php
    vhosts:
        wMrFXPPYmkkV:
            servername: paddle
            serveraliases:
                - www.paddle.dev
            docroot: /var/www/paddle/
            port: ‘80’
            setenv:
                - 'APP_ENV dev'
            override:
                - All
            options:
                - Indexes
                - FollowSymLinks
                - MultiViews
            engine: php
            custom_fragment: ''
            ssl_cert: ''
            ssl_key: ''
            ssl_chain: ''
            ssl_certs_dir: ''
        wyPrUuK2fCUN:
            servername: sawu
            serveraliases:
                - www.isawu.eu
            docroot: /var/www/sawu
            port: ‘80’
            setenv:
                - 'APP_ENV dev'
            override:
                - All
            options:
                - Indexes
                - FollowSymLinks
                - MultiViews
            engine: none
            custom_fragment: ''
            ssl_cert: ''
            ssl_key: ''
            ssl_chain: ''
            ssl_certs_dir: ''
    mod_pagespeed: 0
nginx:
    install: '0'
    settings:
        default_vhost: 1
        proxy_buffer_size: 128k
        proxy_buffers: '4 256k'
    vhosts:
        odBfcPgW2ZWp:
            server_name: awesome.dev
            server_aliases:
                - www.awesome.dev
            www_root: /var/www/awesome
            listen_port: '80'
            location: \.php$
            index_files:
                - index.html
                - index.htm
                - index.php
            envvars:
                - 'APP_ENV dev'
            engine: php
            ssl_cert: ''
            ssl_key: ''
php:
    install: '1'
    version: '55'
    composer: '1'
    composer_home: ''
    modules:
        php:
            - cli
            - intl
            - mcrypt
            - gd
            - curl
        pear: {  }
        pecl:
            - pecl_http
    ini:
        display_errors: On
        error_reporting: '-1'
        session.save_path: /var/lib/php/session
    timezone: Europe/Brussels
    mod_php: '0'
hhvm:
    install: '0'
    nightly: 0
    composer: '1'
    composer_home: ''
    settings:
        host: 127.0.0.1
        port: '9000'
    ini:
        display_errors: On
        error_reporting: '-1'
    timezone: null
xdebug:
    install: '1'
    settings:
        xdebug.default_enable: '1'
        xdebug.remote_autostart: '0'
        xdebug.remote_connect_back: '1'
        xdebug.remote_enable: '1'
        xdebug.remote_handler: dbgp
        xdebug.remote_port: '9000'
xhprof:
    install: '0'
drush:
    install: '1'
    version: 6.3.0
ruby:
    install: '1'
    versions:
        u9bAT3vqEYqY:
            version: ''
nodejs:
    install: '1'
    npm_packages: {  }
python:
    install: '1'
    packages: {  }
    versions:
        xaBU449X5L31:
            version: ''
mysql:
    install: '1'
    root_password: qwer
    adminer: '1'
    databases:
        nFyxeOgVJK1P:
            grant:
                - ALL
            name: paddle
            host: localhost
            user: g
            password: qwer
            sql_file: ''
postgresql:
    install: '0'
    settings:
        root_password: '123'
        user_group: postgres
        encoding: UTF8
        version: '9.3'
    databases: {  }
    adminer: 0
mariadb:
    install: '0'
    root_password: '123'
    adminer: 0
    databases: {  }
    version: '10.0'
sqlite:
    install: '0'
    adminer: 0
    databases: {  }
mongodb:
    install: '1'
    settings:
        auth: 1
        port: '27017'
    databases: {  }
redis:
    install: '0'
    settings:
        conf_port: '6379'
mailcatcher:
    install: '0'
    settings:
        smtp_ip: 0.0.0.0
        smtp_port: 1025
        http_ip: 0.0.0.0
        http_port: '1080'
        mailcatcher_path: /usr/local/rvm/wrappers/default
        from_email_method: inline
beanstalkd:
    install: '0'
    settings:
        listenaddress: 0.0.0.0
        listenport: '13000'
        maxjobsize: '65535'
        maxconnections: '1024'
        binlogdir: /var/lib/beanstalkd/binlog
        binlogfsync: null
        binlogsize: '10485760'
    beanstalk_console: 0
    binlogdir: /var/lib/beanstalkd/binlog
rabbitmq:
    install: '0'
    settings:
        port: '5672'
elastic_search:
    install: '0'
    settings:
        java_install: true
        autoupgrade: true

The vhosts generated seem OK:

[03:14 PM]-[vagrant@packer-virtualbox-iso]-[/etc/apache2/sites-enabled] 
$ cat 25-wMrFXPPYmkkV.conf 
# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************

<VirtualHost *:80>
  ServerName paddle
  ## Vhost docroot
  DocumentRoot "/var/www/paddle/"
  ## Directories, there should at least be a declaration for /var/www/paddle/
  <Directory "/var/www/paddle/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
  </Directory>
  ## Load additional static includes

  ## Logging
  ErrorLog "/var/log/apache2/wMrFXPPYmkkV_error.log"
  ServerSignature Off
  CustomLog "/var/log/apache2/wMrFXPPYmkkV_access.log" combined
  ## Server aliases
  ServerAlias www.paddle.dev
  ## SetEnv/SetEnvIf for environment variables
  SetEnv APP_ENV dev

  ## Custom fragment

    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/paddle//$1
</VirtualHost>

I tried accessing :

http://192.168.56.102/paddle/ 

I got Not Found,

I tried http://192.168.56.102/

I get File not found.

FYI inside /var/www/paddle there's a fully working Drupal website, and in my second vhost there's just an index.html.

Do I need to edit my hosts file in my Host machine? Did I setup something wrong?


Solution

  • Here were the things necessary to make this work:

    1. Change the hosts file (/etc/hosts/) and add two entries for the aliases pointing to the static ip of the VM (192.168.56.102)
    2. I run apachectl ( http://httpd.apache.org/docs/2.2/programs/apachectl.html ) and saw there were errors in one of the default Vhosts of my VM (puphpet screwed something up). Specifically it had SSL entries pointing to non existing cert files. I deleted these entries and tada, works.