I installed ubuntu server that will host a wordpress website. the technologies I am using are:

  1. nginx + php5-fpm as the webserver
  2. vernish as the cache system
  3. mysql database server (RDS).

The issue is when I upload a wordpress media it will save the data in one of the servers and I want to use multiple servers with load balancer as far as I understand I need to use some sharing between the servers and mount it to every server.

My question:

Is there a way I can do it with AWS? or I need to create another server just for hosting the files I am uploading? and what kind of file sharing should I choose as the file sharing system between the EC2 servers?


It's probably easier to use S3 to serve the media uploads than to try and synchronise remote EC2 file systems or share one file system via something like NFS.

  • Thank you very much, do you know by a chance how do I mount S3 to a local folder or how to sync a volume with S3? – talsibony Jan 4 '14 at 17:10
  • You can use s3fs via FUSE to make an S3 bucket look like a local filesystem and copy files into it, just remember that even though it looks, walks and quacks like a file system, it's not a real file system and has eventual consistency – Matt Jan 4 '14 at 17:24
  • @mindthemonkey FYI, US Standard S3 has eventual consistency, but the rest are write-then-read consistent. – ceejayoz Jan 5 '14 at 15:31
  • You shouldn't need to mount S3 to a local folder. Just rely on the wordpress plugins you choose. wordpress.org/plugins/search.php?q=s3 – sciurus Jan 5 '14 at 17:56
  • 1
    @ceejayoz yes, but only for writes of new objects. eveything else is still eventual. – Matt Jan 6 '14 at 12:30

You cannot mount a single volume to multiple servers at the same time. I would recommend looking into a distributed file system like NFS or GlusterFS for best performance. This will let you mount the partitions remotely on the other servers. There may be another file system; these are just the best from my own experiences with AWS EC2.

I would not recommend using S3FS via FUSE given that every time a file is changed, the entire file system is re-uploaded to S3 - it's alright for a couple of files, but it gets quite slow when you have a large number of files on the file system. I've looked around for other implementations but haven't found anything worth using just yet. If you do want to use S3 to serve files, then maybe have another process in the background which uploads or synchronizes the files to the S3 bucket via cURL or S3CMD.

  • "If you do want to use S3 to serve files, then maybe have another process in the background which uploads or synchronizes the files to the S3 bucket via cURL or S3CMD.": This isn't necessary; there are wordpress plugins which can write uploaded media to S3 directly. – sciurus Jan 5 '14 at 17:58
  • Yes, there is a WordPress plugin that already does this. I was focusing more on the fundamental to be used with anything. – jaseeey Jan 6 '14 at 0:28
  • Thank you very much for your answer I am not sure how to use this S3, I decided this time to use NFS and mount the www folder of the NFS server to each EC2, and to make sure only one ec2 will write files (will have access to the wordpress admin) I found this article andy.xd-artist.de/2012/07/04/… – talsibony Jan 7 '14 at 8:58
  • I prefer to use NFS too as it's much quicker and doesn't need to wait until it syncs. You can look into using DRBD for redundancy as well if you want a little side project. – jaseeey Jan 7 '14 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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