# (Plesk for Linux) Storing Backups and Website Files on a Remote Server using NFS

Содержание

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.

- The `-g` or `--manage-gids` option is disabled for the `mountd` process on the remote server. Here’s how to check it:

  - In the `/etc/nfs.conf` file, in the `[mountd]` section, make sure that the `manage-gids` option has the `y` value.

  - In the `/etc/default/nfs-kernel-server` file, make sure that the `RPCMOUNTDOPTS` option has the `--manage-gids` value.

- (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:

1. Connect to your Plesk server via SSH.

2. Install the «NFS client» package by running the `apt install nfs-common` command.

3. In the `/usr/local/psa/admin/conf/panel.ini` file, add the following lines:

       [webserver]
       syncModeOnRemoveConfiguration = true

4. 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.original` command.

5. Create a new «vhosts» directory by running the `mkdir /var/www/vhosts/` command.

6. 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/fstab` command.

   Примечание

   Instead of `NFS_Server_IP_address` and `<NFS_Directory_for_vhosts>`, specify the ones configured on the remote server to which Plesk has access.

7. (Optional) Make sure the network path is mounted automatically after server reboot. To do so, run the `cat /etc/fstab` command. 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

8. Mount the storage by running the `mount /var/www/vhosts` command.

9. (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/vhosts` command. As the response, you will see the following:

       <NFS_Server_IP_address>:<NFS_Directory_for_vhosts> on /var/www/vhosts type nfs4 (<options>)

10. Copy the contents of the source vhosts directory to the new one by running the `cp -aRv /var/www/vhosts.original/* /var/www/vhosts` command.

11. (Optional) Make sure that everything is configured correctly using the Plesk repair utility. To do so, run the `plesk repair all` command.

12. (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.

13. (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.original` command.

Now Plesk will store websites“ files on a remote server via NFS.