doujing3896 2014-02-02 04:12
浏览 91
已采纳

使用PuPHET失败设置Vagrant

I'm using PuPHET tool to setup Vagrant so that a combo vagrant+puppet should just easily boot a VM with vagrant up. Im using a Centos64 setup - php 5.4, and some minor standard debug mode. Im running this on a Mac OSX Maverick.

Here is the configuration:

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'

Now I have also modified the host file found in /etc/hosts and added 192.168.56.101 test.dev

I can ping by IP, I can ping by domain name, I can even vagrant ssh into the VM..

Problem? I cant access it on the browser (which defeats the purpose of the setup). I've dumped a simple php hello world script inside the share folder. I have SSH into the VM to see if its there and it is. But im so lost as to why its not working out of the box? I have also tried to access both on 7943 or 22 port. No avail.

  • 写回答

1条回答 默认 最新

  • doz22551 2014-02-06 17:22
    关注

    I managed to get this working. When working with Vagrant I generally choose either private network or port forwarding but never both.

    If you change your yaml configuration in the forwarded ports section and add

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

    You can then access the virtual host at http://awesome.dev:8080. Note the port 8080 on the end, this means that port 8080 on the host machine is being forwarded to port 80 on the guest.

    Here is a screenshot of it working. http://cdn.imghack.se/images/e38b9d2debc888588581c46b4aebb2c0.png

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)