Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I had a dozen "Work" servers with just PHP-FPM (with other Nginx servers in front), is it possible to setup PHP to store user uploaded files on a different server?

I'm looking to avoid syncing user files on each "Work" server. I want to keep user uploaded files on an isolated server. With files that need to be accessible to the public, they could be distributed through a CDN.

I have several reasons for wanting to do this:

1) The sum file-size of all the uploaded files are several GB. 99% of them are jpg/png/pdf, but there are thousands of them. If I add another "Work" server, I'd rather not sync those files to another server. These "Work" servers should only contain the application code and do the work.

2) From a security standpoint, I don't want user uploaded files on these servers.

So I basically want to avoid writing these files on the hard drives of the "Work" servers.

What options do I have, if any?

share|improve this question
up vote 3 down vote accepted

From your storage server, export an NFS share to your "Work" servers, then mount to whatever location on the work servers you need. As long as you make sure that filenames and directories are unique, you can have several servers writing to the same NFS export at the same time.

share|improve this answer
This seems like a good idea. Is there a way to make it impossible to execute files on this mounted share? Perhaps mounting options that forbid this kind of activity? – Luke Sep 25 '11 at 18:52
Sure, you can mount it noexec just like any other filesystem mount – EEAA Sep 25 '11 at 18:53
Awesome! Just what I was looking for. – Luke Sep 25 '11 at 18:59

Absolutely. My company puts image/video uploads directly onto Amazon S3 using their HTTP POST interface. Works well.

share|improve this answer
I'm not entirely clear what you mean. Many of our forms contain text fields and file upload fields. The text fields need to go to the "Work" server and the files need to be stored on the "Storage" server. This needs to happen in a single POST request (which is routed through the "Web" servers to the "Work" servers). – Luke Sep 25 '11 at 18:53
That's fine. Have your web server pass the file on to S3. We pass them directly to S3 from the form (using a SWFUpload widget) as it removes the middleman. – ceejayoz Sep 25 '11 at 19:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.