(Plesk for Linux) Storing Backups and Website Files on a Remote Server using NFS
summary: In this topic, you will learn how to store backups and websites’ files on a remote server accessible via Network File System (NFS).
Plesk can store websites’ files and backups on a remote server, in cloud storage, or in direct-attached storage. Pluses:
- If you need more resources for the storage, you need to upgrade only the remote server.
- When Plesk stores files on a remote server, you can optimize performance of both servers for better processing of the required tasks. In case of the remote server, for example, you can increase the cache memory size so that it contains more records on the last accesses to the hard drives. In case of the Plesk server, you can give more resources to Nginx and/or Apache so that the services need to access the hard drives less often.
- In case of a cloud SaaS storage, you do not even need a physical server and you also can maintain the storage using the Web interface.
However, storing files and backups on a remote server has the following drawbacks:
- A single server with all the websites’ files and backups of your Plesk becomes the single point of failure. It means that if the remote server goes down, you will have no access to the files.
- Network connection between the Plesk server and the remote server must be broadband and reliable.
Configuring Plesk to Store Backups and Website Files on a Remote Server
Before you start configuring Plesk, make sure that the remote server meets the following requirements:
- The remote server meets the minimum software requirements of the used OS.
- The “NFS server” package is installed on the remote server.
- Directories to be accessed via NFS are configured on the remote server.
--manage-gidsoption is disabled for the
mountdprocess on the remote server. Here’s how to check it:
- In the
/etc/nfs.conffile, in the
[mountd]section, make sure that the
manage-gidsoption has the
- In the
/etc/default/nfs-kernel-serverfile, make sure that the
RPCMOUNTDOPTSoption has the
- In the
- (Recommended) For security reasons, your Plesk server and the remote server are in the same network.
- (Recommended) If you use a physical remote server, it should run on a Linux-based OS.
Configuring Plesk to store websites’ files on a remote server
In the example below, we will describe the configuration process as follows:
- We will use standard paths to websites’ files and directories. If you want to use custom ones, you will need to change the location of websites’ files and/or backups first. After that, you will need to adjust the commands in accordance with the new specified paths.
- We will describe how to configure Plesk to store websites’ files on a remote server. If you want to store Plesk backups on a remote server as well, take the same steps and adjust the paths to the backup directories.
- Plesk server and the remote server are both running on Ubuntu 22.04. If you have servers running on any other OS, you may need to use other commands to perform the required actions. For more information on the commands, refer to the documentation of the used OS.
Here’s how to configure Plesk to store websites’ files on a remote server:
Install the “NFS client” package by running the
apt install nfs-commoncommand.
/usr/local/psa/admin/conf/panel.inifile, add the following lines:
[webserver] syncModeOnRemoveConfiguration = true
Move the existing “vhosts” directory to another one. To do so, add any word (for example, “.original”) to the new directory name, and run the
mv /var/www/vhosts /var/www/vhosts.originalcommand.
Create a new “vhosts” directory by running the
Enable auto mount of the network path after server reboot. To do so, run the
echo <NFS_Server_IP_address>:<NFS_Directory_for_vhosts> /var/www/vhosts nfs hard,timeo=600,retrans=2,_netdev 0 0" >> /etc/fstabcommand.
Note: Instead of
<NFS_Directory_for_vhosts>, specify the ones configured on the remote server to which Plesk has access.
(Optional) Make sure the network path is mounted automatically after server reboot. To do so, run the
cat /etc/fstabcommand. As the response, you will see the following:
<NFS_Server_IP_address>:<NFS_Directory_for_vhosts> /var/www/vhosts nfs hard,timeo=600,retrans=2,_netdev 0 0
Mount the storage by running the
(Optional) Make sure that Plesk will move websites’ files to a remote server instead of copying them to a local directory. To do so, run the
mount | grep /var/www/vhostscommand. As the response, you will see the following:
<NFS_Server_IP_address>:<NFS_Directory_for_vhosts> on /var/www/vhosts type nfs4 (<options>)
Copy the contents of the source vhosts directory to the new one by running the
cp -aRv /var/www/vhosts.original/* /var/www/vhostscommand.
(Optional) Make sure that everything is configured correctly using the Plesk repair utility. To do so, run the
plesk repair allcommand.
(Optional) Reboot the server manually to see if the settings are applied correctly. That way you can be sure that things will work fine after further server reboots.
(Optional) Make sure that the files were copied correctly. If so, you can free the server’s disk space by removing the “vhosts.original” directory. To do so, run the
rm -rf /var/www/vhosts.originalcommand.
Now Plesk will store websites’ files on a remote server via NFS.