Monday | 15 APR 2024
[ previous ]
[ next ]

nginx and Mounts

Title:
Date: 2023-12-04
Tags:  nginx, sysadmin

This is a weird problem which I think might be mac related. I haven't tested it on Linux.

The scenerio is as follows:

You have some content on Server A that you want to use nginx to serve out on Server B. One way to do this is to share out that content via samba and then mount that folder on Server B. Then in nginx you can set it up to serve content from the mounted directory.

This is the same for sshfs as well.

However both options resulted in nginx having permissions issues. At least I think it was permission issues.

*7 open() "/Users/server/example.com/videos/test.txt" failed (1: Operation not permitted)

This was happening if I used mount_smbfs or sshfs.

mount_smbfs:

mount_smbfs -d 0777 -f 0777 //username:pw@192.168.140.13/videos /Users/server/example.com/videos/

sshfs:

sshfs -o uid=501,gid=20,allow_other,rw username@192.168.140.13:/home/videos videos

Ultimately I gave up trying to get it to work and went another route. I would set up nginx on Server A and have it serve out files. Server B will then proxy pass the requests for content to Server A.

This works beautifully and is quite simple. I'm quite a fan and if I put this together before, I may have gone with this even if sshfs worked. There probably is a drawback as that is going over http wheras the sshfs stuff would be going through as straight binary. Luckily for my usecase it won't matter or at least I hope it doesn't matter.