Use NFS mount for Apache/PHP user uploads
Hi! I’m setting up a configuration with multiple webservers (all Ubuntu 20) which run behind a load balancer, and a fileserver (not behind that load balancer) for serving static files like user uploads.
I’ve mounted a directory from the fileserver to my webservers, and I’m able to read and write to that directory, but only when I use the sudo command.
I would like to be able to move uploaded files from Apache/PHP over to the mounted NFS directory so that the files will be accessible from a central location. The NFS mount will only be used to move and delete files to and from that shared directory, not to serve the actual files to the end user. This writing and deleting doesn’t work right now, since PHP (or Apache) doesn’t use sudo and hasn’t got the correct permissions.
What’s the best solution to solve this problem? Or are there better solutions to handle this?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×