I have a collection of files on a Windows share named \\winserver\bucket
.
On a CentOS server, I am able to mount it so the content is available for perusal. I created an empty directory named /mnt/bucket
for mounting.
sudo mount -t cifs -o credentials=/root/bucket.ini \\\\winserver\\bucket /mnt/bucket
The Windows credentials are stored in a relatively secure file (/root/bucket.ini
), and I plan to put the mount directive in /etc/fstab
at some point.
The CentOS server is running nginx, and I need to be able to serve the files in the share, download only, via http links.
As an example, someone clicking on a browser link named http://CentOSname/bucket/item/gizmo.pdf
should receive \\winserver\bucket\item\gizmo.pdf
as a downloaded file.
- What's the best way to make this happen?
- Does the nginx user account need to acquire proper permissions so it can access the files?
- Are the parameters used to mount the Windows volume adequate for sharing it out to nginx?
--- Edit ---
Tero's answer does not work for me.
I added location
and root
parameters to the nginx.conf, and I get a 403 Forbidden error:
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
location /bucket/ {
root /mnt/bucket;
}
Adding autoindex on
to see the directory contents produced the same error.