【发布时间】:2015-07-15 14:33:21
【问题描述】:
我在 Windows 机器上运行 NGINX。我真的很喜欢它来托管使用 CIFS 存储在相邻盒子上的文件,但我不知道如何在配置中处理它。
server {
listen 80;
server_name localhost;
sendfile off;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /share {
root //otherserver/share/files;
}
}
当我尝试从该位置提取文件时,我得到以下信息:
2015/05/05 10:28:37 [error] 6600#13064: *12 CreateFile() "C:\Users\me\Desktop\nginx/\\otherserver/share/files/sample.mp4" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: localhost, request: "GET /share/sample.mp4 HTTP/1.1", host: "localhost"
显然 NGINX 将我的命令解释为相对路径。
有没有办法在 nginx.conf 中使用 CIFS/SMB UNC 路径?
如果没有,我如何托管存储在 CIFS 共享上的文件?
非常感谢!
【问题讨论】:
-
将其挂载为磁盘。但这真是个奇怪的主意
-
感谢您的评论。在 Linux(和 fstab)下,这将非常简单。因为我在 Windows 环境中,将共享作为磁盘安装是解决这个问题的一种丑陋的解决方案。 (除非我可能在 NTFS 级别这样做......)我想我可以在 nginx 配置中编写一个 exec 脚本,它会按需映射路径......但我觉得必须有一种方法可以在 NGINX 中做到这一点.