Back up and move your data
The copies NextPress makes, how to export and import your data with the nextpress command, and what to keep before you move or uninstall.
On this page
NextPress makes or lets you make three kinds of copies:
| Copy | Who makes it | What it is for |
|---|---|---|
| Database backup | NextPress, before an upgrade changes the database, and before a reset or override | Going back to the database as it was |
| Export file | You, with nextpress export | Keeping a copy of your data, or moving it to another install |
| Page file | You, from the Pages screen | Moving one page. See Move pages between sites |
Database backups
- Saved in the
backupsfolder of the install, such as/opt/nextpress/backups/nextpress-db-20261025120000.sql. - Made with
pg_dump, the standard PostgreSQL backup tool. - If the backup fails, the upgrade stops before it changes anything.
- Before each upgrade, all but the three newest backups are removed.
NextPress does not restore a backup for you. Restoring one is a manual job on the server. Backups stay on the same server, so also keep an export somewhere else.
Export your data
Sign in to the server and go to the folder where the file should be saved
Run
Shell nextpress exportThe file nextpress-export-YYYYMMDD-HHMMSS.json appears in the current folder
To include uploaded files such as pictures and videos, add --with-media-files. The file is then a .tar.gz:
nextpress export --with-media-files --out ~/nextpress-export.tar.gzExport options:
| Option | What it does |
|---|---|
--users, --sites, --pages, --blogs, --posts, --comments, --media, --templates, --options | Export only these kinds of data. With none, all of them are exported |
--site <name> | Export only one site, by name or address |
--with-media-files | Include the uploaded files |
--out <path> | Write to this file |
--force | Replace an existing file. Without it, the export refuses to overwrite |
nextpress export --users --posts --site example.comThe export is written to a temporary file first, so a failed export never damages an existing file.
Import an export
Copy the export file to the server
Run
Shell nextpress import nextpress-export-20261025-120000.json
By default, the import replaces rows that already exist with the ones in the file. To keep existing rows and add only what is missing, use --mode skip:
nextpress import nextpress-export.tar.gz --posts --mode skipThe same entity options as the export choose what to import. The file must exist, be readable and not be empty. Export and import both need NextPress to be running.
Try an import on a second install before you rely on an export.
Before you move to a new server or uninstall
- Make an export with
--with-media-files. - Check the file exists and its size is what you expect.
- Copy it off the server.
- Keep a copy of the install's
.envfile somewhere safe. It holds the secrets of the install, including the one that protects saved AI keys.
Uninstalling removes the database, the uploaded files and the install folder. Only an export kept elsewhere can bring the content back.