我的项目用 nginx 部署,其中有个控制器 upload 是上传文件的具体代码如下:
def uploadFile
upload=params[:upload]
name = upload['datafile'].original_filename
directory = 'public/data'
# create the file path
path = File.join(directory,name)
# write the file
File.open(path, "wb") { |f| f.write(upload['datafile'].read)}
end
end
但是 nginx 老是提示
Errno::EACCES in BoyController#uploadfile
Permission denied - public/data/运动检测项.xls 我的 nginx 配置文件如下
user root;
worker_processes 1;
..... 我已经将 user 设置为 root 了,为什么在 linux 下还是提示权限不够