使用PuPHET失败设置Vagrant

时间:2014-02-02 04:12:22

标签: php macos virtualbox vagrant puppet

我正在使用PuPHET工具来设置Vagrant,这样组合的vagrant + puppet就可以轻松地启动虚拟机了。我使用Centos64设置 - php 5.4,以及一些次要的标准调试模式。 我在Mac OSX Maverick上运行它。

以下是配置:

vagrantfile-local:
    vm:
        box: centos64-x64-vbox43-1383512148
        box_url: 'http://box.puphpet.com/centos64-x64-vbox43.box'
        hostname: null
        network:
            private_network: 192.168.56.101
            forwarded_port:
                OhyIDGb9LuDg:
                    host: '7943'
                    guest: '22'
        provider:
            virtualbox:
                modifyvm:
                    natdnshostresolver1: on
                    memory: '1024'
                setextradata:
                    VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root: 1
        provision:
            puppet:
                manifests_path: puphpet/puppet
                manifest_file: manifest.pp
                options:
                    - '--verbose'
                    - '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
                    - '--parser future'
        synced_folder:
            ppWP2lt1BsDi:
                id: vagrant-root
                source: '/Users/Documents/vagrant/www/'
                target: /var/www
                nfs: 'false'
        usable_port_range: 2200..2250
    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:
    packages:
        - vim-common
        - git
    dot_files:
        -
            bash_aliases: null
    _prevent_empty: ''
mailcatcher:
    install: 0
    settings:
        smtp_ip: 0.0.0.0
        smtp_port: 1025
        http_ip: 0.0.0.0
        http_port: '1080'
        path: /usr/local/bin
        log: /var/log/mailcatcher/mailcatcher.log
apache:
    modules:
        - php
        - rewrite
    vhosts:
        geXjvySSeKG4:
            servername: test.dev
            docroot: /var/www/public_html
            port: '80'
            setenv:
                - 'APP_ENV dev'
            override:
                - All
    user: www-data
    group: www-data
    default_vhost: true
    mpm_module: prefork
    mod_pagespeed: 0
    mod_spdy: 0
php:
    version: '54'
    composer: '1'
    modules:
        php:
            - cli
            - intl
            - mcrypt
            - cgi
            - memcache
            - pspell
            - tidy
        pear: {  }
        pecl:
            - pecl_http
    ini:
        display_errors: On
        error_reporting: '-1'
        session.save_path: /var/lib/php/session
        allow_url_fopen: '1'
        allow_url_include: '1'
        error_log: syslog
        apc.enabled: '1'
    timezone: America/Chicago
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'
drush:
    install: 0
    settings:
        drush.tag_branch: 6.x
mysql:
    root_password: ***
    phpmyadmin: '1'
    adminer: 0
    databases:
        kqca9cVkAol1:
            grant:
                - ALL
            name: ***
            host: localhost
            user: ***
            password: ***
            sql_file: ''
mongodb:
    install: 0
    auth: 1
    port: '27017'
    databases: {  }
beanstalkd:
    install: '1'
    settings:
        listenaddress: 10.0.1.5
        listenport: '13000'
        maxjobsize: '65535'
        maxconnections: '1024'
        binlogdir: /var/lib/beanstalkd/binlog
        binlogfsync: null
        binlogsize: '10485760'
    beanstalk_console: '1'
    binlogdir: /var/lib/beanstalkd/binlog
rabbitmq:
    install: 0
    port: '5672'

现在我还修改了/ etc / hosts中的主机文件 并添加了192.168.56.101 test.dev

我可以通过IP ping,我可以通过域名ping,我甚至可以将流入ssh进入VM ..

问题?我无法在浏览器上访问它(这违背了设置的目的)。 我在共享文件夹中抛出了一个简单的php hello world脚本。我有SSH进入VM,看看它是否存在。但我是如此迷失,为什么它没有开箱即用?我也试过在7943或22端口上访问它们。没有用。

1 个答案:

答案 0 :(得分:2)

我设法让这个工作。使用Vagrant时,我通常选择专用网络或端口转发,但绝不选择两者。

如果您在转发端口部分更改了yaml配置并添加

forwarded_port:
    OhyIDGb9LuDg:
        host: '7943'
        guest: '22'
    GET0RirwFFW:
        host: '8080'
        guest: '80'

然后,您可以访问http://awesome.dev:8080处的虚拟主机。注意端口上的端口8080,这意味着主机上的端口8080正被转发到guest虚拟机上的端口80。

以下是它工作的截图。 http://cdn.imghack.se/images/e38b9d2debc888588581c46b4aebb2c0.png