【发布时间】:2016-12-22 14:56:51
【问题描述】:
我正在尝试确定 Vagrant 或 nginx 中是否存在错误。
我有以下Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32"
config.vm.network "private_network", ip: "10.0.1.7"
config.vm.network :forwarded_port, guest: 8080, host: 9005
end
所以我运行vagrant up && vagrant ssh 并且服务器提供并启动。我想手动在我的新 VM 上安装 nginx,所以(根据 the instructions 在 Ubuntu 14.04 上安装 nginx)然后我运行:
sudo apt-get update
sudo apt-get install nginx
nginx 安装。我运行mkdir ~/mysite,然后将其/etc/nginx/nginx.conf 文件更改为:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
location / {
root /home/vagrant/mysite;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
include servers/*;
}
然后我运行nginx -s reload。我收到的错误是:
vagrant@precise32:~$ nginx -s reload
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2016/12/22 00:36:48 [notice] 1442#0: signal process started
2016/12/22 00:36:48 [alert] 1442#0: kill(890, 1) failed (1: Operation not permitted)
我的理解是,vagrant 应该是 VM 上具有 sudo 访问权限和 root 权限的用户。不?谁能重现这一点并弄清楚为什么我无法使用我的自定义 nginx.conf 文件重新加载 nginx?
【问题讨论】:
标签: nginx vagrant ubuntu-14.04 user-permissions