Handle user uploads in static content server (newbie question)

Leonardo Crespo leo at leocrespo.com
Mon Apr 12 05:49:43 MSD 2010


To make it simpler, here's a scenario:

Server A is static.domain.com ip 10.10.10.10 servers ALL static
content (jpegs, gifs, pngs, mp3s etc... including user uploaded
content like photo albums)
Server B is www.domain.com ip 10.10.10.20 servers DYNAMIC content, php files.

If user submits a jpg to his photo album, it'll get uploaded to B, as
page's going to run on server B because it's a .php file (upload.php).
How can the image possibly be served from server A without
synchronization issues?

There, much better. :)

Thanks, Leonardo.

On Mon, Apr 12, 2010 at 10:58 AM, Leonardo Crespo <leo at leocrespo.com> wrote:
> Hi guys.
>
> Newbie question here, apologies in advance.
>
> By using a static content server (nginx as reverse proxy), how does
> one deal with user uploads? I mean, I can understand if I client
> request our website’s /images/logo.png file, because we manually store
> it on the static content server, but what about the photo that our
> user just uploaded to his photo album?
>
> My confusion is: if a request is to a .php file, I’ll pass through the
> back-end server. So If a user wants to upload a file, it’ll be upload
> to /user-uploads/file.jpg *on the back-end server*. How can we make
> the static server serve the image? I’m imagining there has to be some
> sort of synchronization, but then again there the problem that the
> image might take longer to be replicated to the static content server
> and when the user request’s it, he’ll get a 404… not acceptable for
> online businesses.
>
> Can anyone with more experience tell me what am I missing?
>
> Cheers
>
> Leonardo
>



More information about the nginx mailing list