我是一个新手,正在使用 vagrant,并且遇到了无法正常工作的问题。它已经通过端口转发运行良好,我可以访问它。但是,我在让 bower 和 gulp 正常工作方面遇到了麻烦。
问题似乎源于 /var/www 目录被 www-data/www-data 拥有的原因。即使将 vagrant 添加到 www-data 组后,vagrant 用户仍没有任何目录的写入权限。我甚至不能使用 sudo chmod 来添加文件的写权限。
每次尝试运行 bower、gulp 或者 git,我都会收到拒绝访问的错误提示。
非常感谢任何帮助。
Vagrant 文件:
问题似乎源于 /var/www 目录被 www-data/www-data 拥有的原因。即使将 vagrant 添加到 www-data 组后,vagrant 用户仍没有任何目录的写入权限。我甚至不能使用 sudo chmod 来添加文件的写权限。
每次尝试运行 bower、gulp 或者 git,我都会收到拒绝访问的错误提示。
非常感谢任何帮助。
Vagrant 文件:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise32"
config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true
config.ssh.private_key_path = ['~/.vagrant.d/insecure_private_key', '~/.ssh/id_rsa.pub']
config.ssh.forward_agent = true
config.vm.synced_folder "/home/develop/b3c-dev", "/var/www", create: true, group: "vagrant", owner: "www-data"
config.vm.synced_folder "/home/vagrant/b3c_ee/provision", "/var/provision", create: true, group: "root", owner: "root"
config.vm.provider "virtualbox" do |v|
v.name = "B3C Expression Engine Dev Vagrant"
v.customize ["modifyvm", :id, "--memory", "1024"]
end
config.vm.provision "shell", path: "provision/setup.sh"
end
Nginx配置:
server {
listen 80;
server_name test.dev www.test.dev;
root /var/www/public/;
index index.php index.html;
access_log /var/log/nginx/b3c-dev-access.log;
error_log /var/log/nginx/b3c-dev-error.log info;
# Important for VirtualBox
# sendfile off;
location / {
index index.php;
try_files $uri $uri/ @ee;
}
location @ee {
rewrite ^(.*) /index.php?$1 last;
}
location ~* \.php {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_cache off;
fastcgi_index index.php;
}
}
/etc/php/8.0/fpm/pool.d/www.conf
。 - cgaldiolo