Backup & Restore a website from one server to a new server

Discussion in 'HOWTO-Related Questions' started by Gordon Fielden, Feb 6, 2021.

  1. Gordon Fielden

    Gordon Fielden New Member

    There are many Howto with ISPConfig/perfect server, but there's not one on backing up a website oIn SPconfig website server then restoring the website to another ispconfig server, especially if its using Wordpress site which is a real pain. Now I know everyone looking for a replacement to APS for rapid installs, but this would also be very helpful if this was some that could be built into further updates of IPSconfig?
     
  2. boman.de

    boman.de New Member

    There is no tutorial for this but it should be like this if you are using the same domain name:
    Create a Website with the same settings on the new server. Same for database and db user.
    On the new server remove the unneeded files in the web directory (robots.txt, index.html etc.).
    On the old server:
    Code:
    rsync -e ssh -auv /var/www/clients/client1/web15/web/ [email protected]:/var/www/clients/client2/web32/web/
    Backup the database on the old server via phpmyadmin and import on new server.
    On new server change the db settings of wp-config.php with nano and use the ones from the new server (database prefix, etc):
    Code:
    nano /var/www/clients/client2/web32/web/wp-config.php
    Change permissions corresponding on client and web IDs:
    Code:
    chown -R web32:client2 /var/www/clients/client2/web32/web/
    Change IP in the DNS records.
    If your structure on the old and new server are the same, there should be no problems. If you are running some plugins which use some paths collected by their own they might get the absolute paths /var/www/clients/client1/web15/... and have to be edited (mostly in database). That could be annoying but there is no way to change that.
    If you want it easy with all your domains and settings use the migration tool: https://www.ispconfig.org/add-ons/ispconfig-migration-tool/
     
  3. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I think that should be straight forward which is by copying that web files and database from the source to the tartgeted server. Few well figured lines of bash command should do them but I am not about to write it for you though.
     
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    For sites using chroot php-fpm, file paths stay the same, which makes it quite simple. (You will have to go through a change of paths once to move to a chroot php-fpm setup, but after that, future moves are easy.)
     
  5. boman.de

    boman.de New Member

    You are right. Didn't think about this benefit of a chrot environment so far.
     
  6. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    as you say, for wordpress, it's a pain, since so many full filepaths get saved all over the place in the database.
    and yes, you can chroot the site, which solves the filepath issue, but it comes with other issues.
    you need to use the ip in wp-config.php, not localhost. or you need to include the mysql socket in jailkit.

    but if you're trying to migrate a non-chroot wordpress site. just create the website area and empty database on the new server the same way you normally would for a brand new website. then install the duplicator plugin by snap-creek on the wordpress site and use that to backup the site. load the backup archive and the install.php file created by the plugin to the webroot on the new server, and then browse to domainname.com/install.php and restore your site on the new server. it'll handle all of the filepath changes for you, you can even completely change the domain name the site/wordpress uses, it's by far the easiest wordpress migration method i've found.
     
    boman.de likes this.
  7. boman.de

    boman.de New Member

    Yes, the duplicator plugin also came in mind, that's why I'm here. I think it's a good solution for wordpress.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Not sure which plugins you use that cause you such issues, I've never had to modify any paths in my WordPress installs when moving them from one server to another. Just rsynced the web folder to the new system and dumped + copied the database.
     
    ahrasis likes this.
  9. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    I have seen this issue with some sites, I think it it caused by Beaver Builder in my case - not sure.
     
  10. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    there's plenty of problems with filepaths, if you look in most wordpress databases, you'll see paths like /var/www/clients/client12/web345 all over the place, which obviously don't work anymore if either the clientid or webid change.
    also wordfence specifically, creates a .user.ini file in the docroot, containing the full path including clientid and webid, if the site is moved to a different filepath the whole site will refuse to load until the paths in this file are corrected.

    there are some wordpress sites that can be moved without having to make any changes, but i find those are definitely in the minority.
     
  11. Allferry

    Allferry New Member

    @nhybgtvfr, do you happen to have the themes still? I've looked everywhere but no luck.

    Cheers
     
  12. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    did you post this in the wrong thread? there's been no mention of any themes on this thread.
     
  13. Allferry

    Allferry New Member

    Yeah, wrong place, sorry.
     
  14. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

  15. lonerunner

    lonerunner Member

    Wordfence plugin can cause path issues, other than that, i haven't encounter any other related path issues. I think there are .ini and wf-something.php files in wordpress main directory that need to be edit.

    Other than that, migration can be really easy with wordpress, you can even use backup backup option in ispconfig to create backup files and database, then copy over ftp files to new hosting and upload database over phpmyadmin. Set dns if needed and change username, db, and password in wp-config.php file
     

Share This Page