Restore the document encryption

My server uses the encryption feature in NextCloud, I want to move my server to another server. What steps should I take so that the data is safe and the document can be read again by the user?