[GH-ISSUE #90] [Feature Request] Export Settings #81

Closed
opened 2026-02-26 05:34:13 +03:00 by kerem · 10 comments
Owner

Originally created by @danmed on GitHub (Mar 1, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/90

I have this up and running finally using the mariadb as part of the stack, but i'd like to move it to my external MySQL server.. Unfortunately that means (as far as i can tell) i'm going to have to add all my hosts again... (i think).

Is there any way to export the current config, rebuild the docker, and import it again once it's pointing at MySQL instead?

Originally created by @danmed on GitHub (Mar 1, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/90 I have this up and running finally using the mariadb as part of the stack, but i'd like to move it to my external MySQL server.. Unfortunately that means (as far as i can tell) i'm going to have to add all my hosts again... (i think). Is there any way to export the current config, rebuild the docker, and import it again once it's pointing at MySQL instead?
kerem closed this issue 2026-02-26 05:34:13 +03:00
Author
Owner

@jc21 commented on GitHub (Mar 3, 2019):

EDIT: See https://github.com/jc21/nginx-proxy-manager/discussions/1529 for information about how to export / import / migrate data from your npm instances.

Sure I can see how an export feature might be useful. For now though, you only need to keep your config file, data folder, letsencrypt folder and dump your sql.

You can export your database with a script like this:

MYSQL_USER=npm
MYSQL_PASS=npm
MYSQL_DB=npm
docker exec -ti nginx-proxy-manager_db_1 mysqldump -u $MYSQL_USER --password=$MYSQL_PASS $MYSQL_DB > dump.sql

For the rest of the data I guess it depends on how you're running the docker environment.

<!-- gh-comment-id:469074216 --> @jc21 commented on GitHub (Mar 3, 2019): EDIT: See https://github.com/jc21/nginx-proxy-manager/discussions/1529 for information about how to export / import / migrate data from your npm instances. Sure I can see how an export feature might be useful. For now though, you only need to keep your config file, `data` folder, `letsencrypt` folder and dump your sql. You can export your database with a script like this: ```bash MYSQL_USER=npm MYSQL_PASS=npm MYSQL_DB=npm docker exec -ti nginx-proxy-manager_db_1 mysqldump -u $MYSQL_USER --password=$MYSQL_PASS $MYSQL_DB > dump.sql ``` For the rest of the data I guess it depends on how you're running the docker environment.
Author
Owner

@MartinKuhl commented on GitHub (May 8, 2020):

when I try to import the exported data on a new created docker image, all information are back. I can see all the configuration within the UI. But it isn't working. I have to edit each proxy configuration and save it (without modification) and now it works. Is there any script for reinitializing the configuration?

<!-- gh-comment-id:625929552 --> @MartinKuhl commented on GitHub (May 8, 2020): when I try to import the exported data on a new created docker image, all information are back. I can see all the configuration within the UI. But it isn't working. I have to edit each proxy configuration and save it (without modification) and now it works. Is there any script for reinitializing the configuration?
Author
Owner

@danmed commented on GitHub (May 9, 2020):

Did you reimport the database?

<!-- gh-comment-id:626151655 --> @danmed commented on GitHub (May 9, 2020): Did you reimport the database?
Author
Owner

@MartinKuhl commented on GitHub (May 9, 2020):

yes I did.

<!-- gh-comment-id:626222107 --> @MartinKuhl commented on GitHub (May 9, 2020): yes I did.
Author
Owner

@MartinKuhl commented on GitHub (May 11, 2020):

The missing key was the folder /data/nginx. After saving and restoring the folder /data/nginx together with a database dump and restore now everting is back and ready to work.

<!-- gh-comment-id:626893121 --> @MartinKuhl commented on GitHub (May 11, 2020): The missing key was the folder /data/nginx. After saving and restoring the folder /data/nginx together with a database dump and restore now everting is back and ready to work.
Author
Owner

@johncadengo commented on GitHub (Dec 12, 2020):

Just for anyone else attempting this, I had a little trouble running the command as is:

docker exec -ti nginx-proxy-manager_db_1 mysqldump -u $MYSQL_USER --password=$MYSQL_PASS $MYSQL_DB > dump.sql

Because it would default to localhost for the hostname. I would get this error:

$ cat dump.sql 
mysqldump: Got error: 1045: "Access denied for user 'npm'@'localhost' (using password: YES)" when trying to connect

Not sure why, but I had to supply the hostname as 127.0.0.1 to get mine to work:

docker exec -ti nginx-proxy-manager_db_1 mysqldump -u $MYSQL_USER --password=$MYSQL_PASS -h 127.0.0.1 $MYSQL_DB > dump.sql
<!-- gh-comment-id:743919007 --> @johncadengo commented on GitHub (Dec 12, 2020): Just for anyone else attempting this, I had a little trouble running the command as is: ``` docker exec -ti nginx-proxy-manager_db_1 mysqldump -u $MYSQL_USER --password=$MYSQL_PASS $MYSQL_DB > dump.sql ``` Because it would default to `localhost` for the hostname. I would get this error: ``` $ cat dump.sql mysqldump: Got error: 1045: "Access denied for user 'npm'@'localhost' (using password: YES)" when trying to connect ``` Not sure why, but I had to supply the hostname as `127.0.0.1` to get mine to work: ``` docker exec -ti nginx-proxy-manager_db_1 mysqldump -u $MYSQL_USER --password=$MYSQL_PASS -h 127.0.0.1 $MYSQL_DB > dump.sql ```
Author
Owner

@rtthane commented on GitHub (Apr 18, 2021):

The missing key was the folder /data/nginx. After saving and restoring the folder /data/nginx together with a database dump and restore now everting is back and ready to work.

Can i ask what restore command you used please?

<!-- gh-comment-id:822056608 --> @rtthane commented on GitHub (Apr 18, 2021): > The missing key was the folder /data/nginx. After saving and restoring the folder /data/nginx together with a database dump and restore now everting is back and ready to work. Can i ask what restore command you used please?
Author
Owner

@MartinKuhl commented on GitHub (Apr 19, 2021):

Hi @rtthane,
first I save the following folders:

docker exec -it nginx tar -zcvf /transfer/backup/nginx/SSL_backup.tar.gz /etc/letsencrypt/
docker exec -it nginx tar -zcvf /transfer/backup/nginx/nginx_conf.tar.gz /data/nginx

and the DB (remember to replace mysqluser and mysqlpassword with the values from your docker-compose):

docker exec -it db bash -c "mysqldump --user=mysqluser --password=mysqlpassword nginx > /transfer/backup/nginx/nginx-backup.sql"

For the restore I use the following commands (replace username and password again):

docker exec -it db bash -c "mysqldump --user=mysqluser --password=mysqlpassword nginx > /transfer/backup/nginx/nginx-backup.sql"
docker-compose restart nginx
docker exec -it nginx nginx -t
docker exec -it nginx nginx -s reload
<!-- gh-comment-id:822212289 --> @MartinKuhl commented on GitHub (Apr 19, 2021): Hi @rtthane, first I save the following folders: ``` docker exec -it nginx tar -zcvf /transfer/backup/nginx/SSL_backup.tar.gz /etc/letsencrypt/ docker exec -it nginx tar -zcvf /transfer/backup/nginx/nginx_conf.tar.gz /data/nginx ``` and the DB (remember to replace `mysqluser` and `mysqlpassword` with the values from your docker-compose): ``` docker exec -it db bash -c "mysqldump --user=mysqluser --password=mysqlpassword nginx > /transfer/backup/nginx/nginx-backup.sql" ``` For the restore I use the following commands (replace username and password again): ``` docker exec -it db bash -c "mysqldump --user=mysqluser --password=mysqlpassword nginx > /transfer/backup/nginx/nginx-backup.sql" docker-compose restart nginx docker exec -it nginx nginx -t docker exec -it nginx nginx -s reload ```
Author
Owner

@rtthane commented on GitHub (Apr 19, 2021):

Hi @rtthane,
first I save the following folders:
docker exec -it nginx tar -zcvf /transfer/backup/nginx/SSL_backup.tar.gz /etc/letsencrypt/
docker exec -it nginx tar -zcvf /transfer/backup/nginx/nginx_conf.tar.gz /data/nginx

and the DB:
docker exec -it db bash -c "mysqldump -uadmin -p123456 nginx > /transfer/backup/nginx/nginx-backup.sql"

For the restore I use the following commands:

docker exec -it db bash -c "mysqldump -uadmin -p123456 nginx > /transfer/backup/nginx/nginx-backup.sql"
docker-compose restart nginx
docker exec -it nginx nginx -t
docker exec -it nginx nginx -s reload

@MartinKuhl really useful info, thanks for taking the time to post it.

<!-- gh-comment-id:822364048 --> @rtthane commented on GitHub (Apr 19, 2021): > Hi @rtthane, > first I save the following folders: > docker exec -it nginx tar -zcvf /transfer/backup/nginx/SSL_backup.tar.gz /etc/letsencrypt/ > docker exec -it nginx tar -zcvf /transfer/backup/nginx/nginx_conf.tar.gz /data/nginx > > and the DB: > docker exec -it db bash -c "mysqldump -uadmin -p123456 nginx > /transfer/backup/nginx/nginx-backup.sql" > > For the restore I use the following commands: > > docker exec -it db bash -c "mysqldump -uadmin -p123456 nginx > /transfer/backup/nginx/nginx-backup.sql" > docker-compose restart nginx > docker exec -it nginx nginx -t > docker exec -it nginx nginx -s reload @MartinKuhl really useful info, thanks for taking the time to post it.
Author
Owner

@chaptergy commented on GitHub (May 10, 2021):

Closing this in favor of https://github.com/jc21/nginx-proxy-manager/issues/168

<!-- gh-comment-id:837419832 --> @chaptergy commented on GitHub (May 10, 2021): Closing this in favor of https://github.com/jc21/nginx-proxy-manager/issues/168
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#81
No description provided.