我刚刚设置了我的虚拟机设置与vagrant。 我在https://puphpet.com上配置了虚拟机配置。
一切都很好并且有效(我可以ssh到VM,......)。但我似乎无法连接到我的应用程序中的正确文件夹。
我的应用程序是一个Symfony 3.2应用程序,因此默认的连接文件夹和文件是:/web/app.php(或/web/app_dev.php)。
当我运行vagrant时,它会自动在共享文件夹的根文件夹中创建一个带有index.html文件夹的html(所以在./中)虽然我没有这样设置它。
我知道它只是调整了设置(我猜?),但我似乎无法让它发挥作用。
这是我的config.yml:
vagrantfile:
target: local
vm:
provider:
local:
box: puphpet/ubuntu1604-x64
box_url: puphpet/ubuntu1604-x64
box_version: '0'
chosen_virtualizer: virtualbox
virtualizers:
virtualbox:
modifyvm:
natdnshostresolver1: false
showgui: 0
vmware:
numvcpus: 1
parallels:
linked_clone: 0
check_guest_tools: 0
update_guest_tools: 0
machines:
vflm_yo94xzj3amtb:
id: IDOFMACHINE
hostname: machine1.puphpet
network:
private_network: 192.168.56.101
memory: '512'
cpus: '1'
provision:
puppet:
manifests_path: puphpet/puppet/manifests
module_path:
- puphpet/puppet/modules
- puphpet/puppet/manifests
options:
- '--verbose'
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
synced_folder:
vflsf_4nfi36d4rw19:
source: ./
target: /var/www
sync_type: nfs
smb:
smb_host: ''
smb_username: ''
smb_password: ''
mount_options:
dir_mode: '0775'
file_mode: '0664'
rsync:
args:
- '--verbose'
- '--archive'
- '-z'
exclude:
- .vagrant/
- .git/
auto: 'true'
owner: www-data
group: www-data
usable_port_range:
start: 10200
stop: 10500
post_up_message: ''
ssh:
host: 'false'
port: 'false'
private_key_path: 'false'
username: vagrant
guest_port: 'false'
keep_alive: '1'
forward_agent: 'false'
forward_x11: 'false'
shell: 'bash -l'
insert_key: 'false'
vagrant:
host: detect
proxy:
http: ''
https: ''
ftp: ''
no_proxy: ''
server:
install: '1'
packages:
- vim
users_groups:
install: '1'
groups:
- USERGROUP
users:
- USERNAME
locale:
install: '1'
settings:
default_locale: en_US.UTF-8
locales:
- en_GB.UTF-8
- en_US.UTF-8
timezone: Europe/Brussels
firewall:
install: '1'
rules: { }
cron:
install: '1'
jobs: { }
nginx:
install: '1'
settings:
version: present
default_vhost: 1
proxy_buffers: '4 256k'
proxy_buffer_size: 128k
proxy_connect_timeout: 600s
proxy_send_timeout: 600s
proxy_read_timeout: 600s
names_hash_bucket_size: 128
upstreams: { }
vhosts: { }
proxies: { }
letsencrypt:
install: '1'
settings:
email: ''
domains: { }
php:
install: '1'
settings:
version: '7.1'
modules:
php:
- cli
- intl
- xml
pear: { }
pecl: { }
ini:
display_errors: 'On'
error_reporting: '-1'
session.save_path: /var/lib/php/session
date.timezone: UTC
fpm_ini:
error_log: /var/log/php-fpm.log
fpm_pools:
phpfp_fo0v12pi60wc:
ini:
prefix: www
listen: '127.0.0.1:9000'
security.limit_extensions: .php
user: www-user
group: www-data
composer: '1'
composer_home: ''
ruby:
install: '1'
versions:
rv_3wwtzfmr5ph7:
default: '1'
bundler: '1'
version: 2.3.1
gems:
- deep_merge@1.0.1
- activesupport@4.2.6
- vine@0.2
python:
install: '1'
packages: { }
versions: { }
mysql:
install: '1'
settings:
version: '5.7'
root_password: PASSWORD
override_options: { }
adminer: 0
users:
mysqlnu_dhshopbnzmjt:
name: DBNAME
password: DBPASSWORD
databases:
mysqlnd_cgzy7ctnghxn:
name: dbname
sql: ''
grants:
mysqlng_176bhrghj78b:
user: dbuser
table: '*.*'
privileges:
- ALL
非常感谢
答案 0 :(得分:0)
你实际上没有设置任何虚拟主机。
例如,这是默认的Nginx部分:
nginx:
install: '1'
settings:
version: present
default_vhost: 1
proxy_buffers: '4 256k'
proxy_buffer_size: 128k
proxy_connect_timeout: 600s
proxy_send_timeout: 600s
proxy_read_timeout: 600s
names_hash_bucket_size: 128
upstreams: { }
vhosts:
nxv_g7clf38t8tsy:
server_name: awesome.dev
server_aliases:
- www.awesome.dev
www_root: /var/www/awesome
listen_port: '80'
client_max_body_size: 1m
ssl: '0'
ssl_cert: ''
ssl_key: ''
ssl_port: '443'
ssl_protocols: ''
ssl_ciphers: ''
rewrite_to_https: '1'
spdy: '1'
locations:
nxvl_1anmyow0cd4b:
www_root: ''
location: /
index_files:
- index.html
- index.htm
- index.php
try_files:
- $uri
- $uri/
- /index.php$is_args$args
fastcgi: ''
fastcgi_index: ''
fastcgi_split_path: ''
proxy: ''
proxy_redirect: ''
nxvl_yhk6qxrhfjqr:
www_root: ''
location: '~ \.php$'
try_files:
- $uri
- $uri/
- /index.php$is_args$args
fastcgi: '127.0.0.1:9000'
fastcgi_index: index.php
fastcgi_split_path: '^(.+\.php)(/.*)$'
fast_cgi_params_extra:
- 'SCRIPT_FILENAME $request_filename'
- 'APP_ENV dev'
set:
- '$path_info $fastcgi_path_info'
proxy: ''
proxy_redirect: ''
proxies: { }
您的配置缺少整个vhosts:
阻止。
重新创建您的配置。