php – Vagrant,找不到Apache文件

前端之家收集整理的这篇文章主要介绍了php – Vagrant,找不到Apache文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我想安装一个有流浪汉的虚拟机.
我使用puphet来启动和运行我的虚拟机.
我从https://puphpet.com/下载了我的文件
我运行命令vagrant up.
这工作正常,没有错误.
但是当我去我的apache服务器(ip:192.168.56.101/).它说

    File not found

我的config.yaml看起来像这样:

vagrantfile-local:
vm:
    Box: puPHPet/debian75-x64
    Box_url: puPHPet/debian75-x64
    hostname: ''
    memory: '512'
    cpus: '1'
    chosen_provider: virtualBox
    network:
        private_network: 192.168.56.101
        forwarded_port:
            3gxDQCQAxfdF:
                host: '7872'
                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:
        ncdRZBfrkcfO:
            source: ./
            target: /var/www
            sync_type: default
            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
    vhosts:
        aVIZQPIIn6i3:
            servername: awesome.dev
            serveraliases:
                - www.awesome.dev
            docroot: /var/www/awesome
            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: ''
    mod_pagespeed: 0
Nginx:
    install: '0'
    settings:
        default_vhost: 1
        proxy_buffer_size: 128k
        proxy_buffers: '4 256k'
    vhosts:
        uwr7HyJ5WO1T:
            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: '56'
    composer: '1'
    composer_home: ''
    modules:
        PHP:
            - cli
            - intl
            - mcrypt
        pear: {  }
        pecl:
            - pecl_http
    ini:
        display_errors: On
        error_reporting: '-1'
        session.save_path: /var/lib/PHP/session
    timezone: America/Chicago
    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: '0'
    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: '0'
    version: 6.3.0
ruby:
    install: '1'
    versions:
        TSsZyQH2LHKq:
            version: ''
nodejs:
    install: '1'
    npm_packages: {  }
python:
    install: '1'
    packages: {  }
    versions:
        YVfdTeUuv8wW:
            version: ''
MysqL:
    install: '1'
    root_password: '123'
    adminer: 0
    databases:
        99Rdxm92r7xO:
            grant:
                - ALL
            name: dbname
            host: localhost
            user: dbuser
            password: '123'
            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: '0'
    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
最佳答案
在设置流浪汉时我也偶然发现了这个问题.

我在我的日志中发现问题是fcgi所以我注意到由vagrant创建的vhost文件中的这一行:

ProxyPassMatch ^/(.*\.PHP(/.*)?)$fcgi://127.0.0.1:9000/var/www//$1

将其更改为:

ProxyPassMatch ^/(.*\.PHP(/.*)?)$fcgi://127.0.0.1:9000/var/www/awesome/$1

它现在应该工作.现在的问题是,每次使用vagrant时都必须编辑它

我也得到了一个解决方案,也许不是最好的解决方案,但它可以工作,除非有人提出更好的解决方案,否则我会使用它.

将config.yaml中的vhosts部分更改为以下内容

 vhosts:
    [your hash]
        server_name: awesome.dev
        server_aliases:
            - www.awesome.dev
        docroot: /var/www/
        port: '80'
        setenv:
            - 'APP_ENV dev'
        directories:
            provider: directory
            path: /var/www/awesome/
            allow_override:
                - All
            options:
                - Indexes
                - FollowSymLinks
                - MultiViews
        engine: PHP
        custom_fragment: ''
        ssl: '0'
        ssl_cert: ''
        ssl_key: ''
        ssl_chain: ''
        ssl_certs_dir: ''

在你的puPHPet文件夹中搜索这个文件:puppet / modules / puPHPet / templates / apache / custom_fragments.erb并将其内容更改为:

<%= @vhost['custom_fragment'] %>
<% if !@require_mod_PHP %>
  <% if @vhost.has_key?('engine') %>
    <% if @vhost['engine'] == 'PHP' %>
      <% if @vhost.has_key?('directories') %>
        <% if @vhost['directories'].has_key?('path') %>
          ProxyPassMatch ^/(.*\.PHP(/.*)?)$fcgi://<%= @fcgi_string %><%= @vhost['directories']['path'] %>$1
        <% else %>
          ProxyPassMatch ^/(.*\.PHP(/.*)?)$fcgi://<%= @fcgi_string %><%= @vhost['docroot'] %>/$1
        <% end %>
      <% else %>
        ProxyPassMatch ^/(.*\.PHP(/.*)?)$fcgi://<%= @fcgi_string %><%= @vhost['docroot'] %>/$1
      <% end %>
    <% end %>
  <% end %>
<% end %>

然后我做了流浪汉摧毁和流浪汉,它的工作.

猜你在找的Linux相关文章