How to Sync Two Apache Web Servers/Websites Using Rsync

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Tarunika Shrivastava

I am a linux server admin and love to play with Linux and all other distributions of it. I am working as System Engineer with a Web Hosting Company.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

36 Responses

  1. An other hint that I have noticed: why do you share the ssh authentication file for root instead of your alternative user in your tutorial?

  2. Hey Tarunika, first thanks for your great tutorial.

    Anyways does your solution only permanently synchronize the two folders? I think that’s not what I need. What I need are daily and weekly backups.

    Maybe I can use your solution and modify it so that before synchronization the latest backup is copied to an other directory.
    But in this case I were resulting in duplicated disc usage.

  3. jagdish says:

    Great Post …

    Main Server

    IP Address:

    Backup Server

    IP Address:

    if i have made some changes index.html file in main server… it work …. Backup server get updated..
    But i have change some contain index.html file in backup server….. it is not work ….

    in backup server & main server

  4. Gilank says:

    Hi, you must add some tutorial when one server down, it will automatically redirect to backup server , it will contain some dns setup

  5. Mike says:

    This is from around 1999 but still the very best rsync tutorial I’ve ever read.

  6. How to backup on real time ?? I mean a file is created on folder and it needs to be moved in to another folder. Is that possible using rsync. I tried adding cron job with –remove-source-files but to no avail.

  7. xicoloco says:

    every time i run the sync he copy everything or just what changed ?

    and he delete wuat is not there tooo ?

  8. Troy Rose says:

    A couple of things.

    What are the benefits in terms of security of running rsync as root when all you are doing is replicating apache/httpd user files?

    Also, if your backup up web server is compromised, then the attacker now has complete access to your main webserver as root.

  9. David Nguyen says:

    Hi Tarunika,

    Can I use rsync to entirely backup for LAMP(including data and program) ?


  10. Aby Varghese says:

    Thank you ! Great Post .;

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.