How to restore Plesk installation on a new Windows server after disaster

Created:

2016-11-16 12:53:20 UTC

Modified:

2017-03-23 16:46:10 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to restore Plesk installation on a new Windows server after disaster

Symptoms

During the course of disaster recovery, it is necessary to set up a new Plesk instance and migrate all server settings and customer data from the old server.

Resolution

We strongly recommend to restore server from server backup. It will be the best way to solve the issue.

Also, the following instructions can be used, but we can not guarantee no issue will be faced.

Please note that server configuration (paths) should be exactly the same.

Let us assume that:

plesk_dir=C:\Plesk   
plesk_vhosts=C:\Inetpub\vhosts
  1. Create container/server with exactly the same version of Plesk with same set of tools installed, with the same DB providers and same IP addresses.

  2. Mount HDD from crashed server on the new server (we assume it is D:\).

  3. Connect by RDP.

  4. Stop all Plesk services.

  5. Copy D:\Plesk\sb\config into C:\Plesk\sb\config and D:\Plesk\sb\sites into C:\Plesk\sb\sites accordinly.

  6. Copy D:\Plesk\var\apspackages into C:\Plesk\var\apspackages .

  7. Copy Horde DB password from D:\Plesk\Webmail\horde\conf\.horde.shadow to C:\Plesk\Webmail\horde\conf\.horde.shadow .

  8. Copy Plesk/APSC databases (make sure that MySQL/MSSQL services are stopped on the source server).

  9. in case of MySQL - copy D:\Plesk\MySQL\Data into C:\Plesk\MySQL\Data .

  10. in case of Plesk engine is MSSQL - copy D:\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data to C:\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data . Attach Plesk database using Microsoft SQL Server Management Studio or any other MSSQL Management Utility.

  11. Copy content from D:\Inetpub\vhosts into C:\Inetpub\vhosts

  12. Copy mail content:

  13. MailEnable Server - D:\Plesk\Mail Servers\Mail Enable , folders Config , Postoffices , Queues .

  14. SmarterMail Server - copy appropriate MailBoxes with content, configuration of MTA to the new server.

  15. Copy Databases from D:\Plesk\Databases\MySQL into C:\Plesk\Databases\MySQL . Same operation for C:\Plesk\Databases\MSSQL . Attach MSSQL databases using Microsoft SQL Server Management Studio or any other MSSQL Management Utility.

  16. Copy certificates from D:\Backup\Plesk\var\certificates to C:\Plesk\var\certificates .

  17. Start Plesk services.

  18. Set Administrator password exactly the same as on crashed server:

     "%plesk_bin%\plesksrvclient.exe" -set setup

    If you have any issues with reseting password with plesksrvclient.exe utility, restore MySQL "admin" password according to the following KB http://kb.plesk.com.com/213947045 .

  19. In case of issues with Plesk Panel access under admin, please apply KB article #213409509 for admin user.

  20. Restore MSSQL "sa" password with MSSQL Management Studio .

    Reconfigure MSSQL Webadmin:

    "%plesk_cli%/repair" --reconfigure-mssql-webadmin-site
    "%plesk_cli%/repair" --update-mssql-users-permissions
  21. Find and rename/delete all '.Security' files in vhosts folders:

    For Plesk 11 and less:

     "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT name FROM domains WHERE htype = 'vrt_hst'" > list.txt
    for /f "skip=1" %i in (list.txt) do del %plesk_vhosts%\%i\.Security

    Or this script can be used:

    for /F "skip=1 usebackq" %r in (`dbclient.exe --direct-sql "--sql=select name from domains"`) do move "%plesk_vhosts%"\%r\.Security "%plesk_vhosts%"\%r\.Security.old

    For Plesk 11.5 and above:

    for /F "skip=1 usebackq" %r in (`dbclient.exe --direct-sql "--sql=select name from domains"`) do move "%plesk_vhosts%"\%r\.plesk\.Security "%plesk_vhosts%"\%r\.plesk\.Security.old
  22. Reset passwords according to the KB article #213948105

  23. Create system ftp and IUSR users in Windows system:

    "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT su.login,accounts.password,su.home FROM sys_users su LEFT JOIN accounts ON su.account_id=accounts.id" > accounts.list.txt   
    for /f "skip=1 tokens=1-3" %x in (accounts.list.txt) do "%plesk_bin%\usermng.exe" --add --name=%x --password=%y --home=%z
  24. Run Reconfigurator and perform 'Repair Plesk Installation', 'Plesk Virtual Hosts security' - it recreates systems users and restores permissions.

    reconfigurator.exe /check=VirtualHostsSecurity
  25. Recreate domains in IIS Web server:

    For Plesk 11.0:

    "%plesk_bin%\websrvmng.exe" --reconfigure-all

    Or better way per domain:

    "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT displayName FROM domains" > domains.txt    
    for /f "skip=1" %i in (domains.txt) do "%plesk_dir%\bin\websrvmng.exe" --reconfigure-vhost --vhost-name=%i

    For Plesk 11.5 and higher:

    "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT displayName FROM domains" > domains.txt    
    for /f "skip=1" %i in (domains.txt) do "%plesk_dir%\bin\repair.exe" --reconfigure-web-site -web-site-name %i
    "%plesk_dir%\bin\repair.exe" --synchronize-protected-directories-storage
    "%plesk_dir%\bin\repair.exe" --repair-all-webspaces-security
    "%plesk_dir%\bin\repair.exe" --synchronize-impersonation-storage
    "%plesk_dir%\bin\repair.exe" --synchronize-protected-directories-storage
    for /f "tokens=*" %d in ('type C:\domains.txt') do repair.exe --repair-webspace-security -webspace-name %d
  26. Reconfigure FTP:

    For Plesk 11.0:

    "%plesk_bin%\ftpmng.exe" --reconfigure-all

    For Plesk 11.5 and higher:

    "%plesk_dir%\bin\repair.exe"  --reconfigure-ftp-sites
  27. Reconfigure Mail server:

    "%plesk_bin%\mchk.exe" --all --fix=all

    In case of Webmail issues please reinstall Horde .

  28. Update DNS zones:

    "%plesk_bin%\dnsmng.exe" update *
Have more questions? Submit a request
Please sign in to leave a comment.