I want to dump a database in a remote server www.myweb.io with ssl. The mongo version is 2.6.12. It seems that I have to use mongoimport. I am looking at /etc/nginx/sites-enabled/myweb.io:

server {
    listen 443 ssl;

    server_name myweb.io www.myweb.io;

    ssl_certificate /etc/letsencrypt/live/myweb.io/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/myweb.io/privkey.pem;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;

But I just realized that there is no /etc/letsencrypt/live/myweb.io/fullchain.pem and /etc/letsencrypt/live/myweb.io/privkey.pem in my server. Does anyone know why the website still works?

Then in this case, where should i find --sslCAFile or --sslPEMKeyFile to make mongoimport work?

  • Nginx is a web server, so the configuration for this should be unrelated to accessing your MongoDB server. Your MongoDB server may be running on the same host as Nginx, but you probably have to remotely login via ssh or similar in order to connect to your MongoDB server. It's not clear why your Nginx server wouldn't be complaining about invalid paths on startup, but that's really a separate question from exporting data from MongoDB.
    – Stennie
    Nov 24 '17 at 3:02
  • The mongoimport tool is for importing JSON/CSV data into a MongoDB server; if your goal is to export collection as JSON/CSV you need to use mongoexport. If you want to backup a database (rather than a single collection) you should use mongodump. With the current information in your question it is unclear what you actually need in order to connect to your MongoDB server, but I would suggest looking at the connecting string used in your application. The same connection options should work for the MongoDB command line tools.
    – Stennie
    Nov 24 '17 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.