• Resolved x3110

    (@x3110)


    I have wordpress installed and load balanced.

    Is there anyway to synced the wp-content/uploads folder between server or better yet sync it to a dedicated static content server and still be able to use the native upload functionality?

    I would prefer to have my uploads folder reside on a dedicated box where it can be offloaded to a CDN in the near future.

    At the moment, i’m not using the built-in upload.

Viewing 4 replies - 1 through 4 (of 4 total)
  • *Bump*

    Could anyone please try to answer the question. It would be a great help to me!
    Thank you in advance to any suggestions!

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Okay. The answer to the question is no.

    At least, it cannot be done without extreme modification of the uploading functionality. So much that it would be simpler to replace it entirely.

    Of course, you can always do an end run around the whole process. Simply make the uploads folder a symlink to another folder on another machine entirely, say, via an NFS mount or some such thing.

    Are the two servers UNIX machines? If so, I really like the rsync command for doing this. It’s a pretty common package on most UNIX systems these days.

    To do this, create a script called something like syncit.sh
    #######snip######
    #!/bin/sh
    # syncit.sh script on server.foo.com

    /usr/bin/rsync –recursive –perms –update –links –delete –owner –group –times –progress /path/to/source/directory/* server.bar.com:/path/to/destination directory/`
    ######/snip#####

    The machine we are on is called server.foo.com, while the machine we want to send the files to is called server.bar.com

    It uses ssh to make the connection, so you have to have ssh connectivity between them. Also, it will ask you for your password, so there are a few more steps if you want to have this happen all by itself. If this seems like the road you want to go down, I can help you with the other steps.

    Thread Starter x3110

    (@x3110)

    Found a solution.

    I’ve set it up so that that wp-admin is always loaded in to SERVER1. Once a user has uploaded files using WordPress into SERVER1, I rsync wp-upload to SERVER2.

    The key was making sure that wp-admin is accessible on 1 server that is being load balanced.

    Once we have a need to use a CDN to serve wp-upload items, I would only have to modify the $siteurl to point to the CDN url for the upload’s base url (wp_upload_dir function).

    Thanks for the other suggestions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to sync uploads folder between servers’ is closed to new replies.