Recently, I want to write a personal blog backend interface with Node and MongoDB. After testing it locally, I want to try it online.

1. Install MongoDB in the pagoda’s app store

2. Configure connection to external network

  • Set the listening port to0.0.0.0The original is127.0.0.1Allowing only local access is now allowed outside the network

  • In the pagoda’s security TAB, release port 27017

  • Add a rule to the firewall in Tencent Cloud [admin console] to allow port 27017 to enter and exit.

3. Configure the account password

  • Go to the MongoDB installation directory. Below is the default directory for the pagoda panel

    cd /www/server/mongodb/bin

  • Enter the mongo command line to enter the mongodb environment

    mongo

  • Set the account password for the admin database

    • Switch to the Admin database

      use admin
    • Set the user and password

      db.createUser({user:'root',pwd:'admin_mima',roles:['root']})
    • Verify that the addition was successful, db.auth(username, password)

      db.auth('root', 'admin_mima')
  • Set up account and password for other databases

    • Switch to the myblog database

      use myblog
    • Set the user and password

      db.createUser({user:'test',pwd:'123456',roles:['readWrite']})
    • Verify that the addition was successful, db.auth(username, password)

      db.auth('test', '123456')

4. Enable secure login

authorizationChange disable to enable

5. Settings in the project

  • Project location

  • Modify the background project connection database configuration

  • Start the background project

Download and start the PM2 Manager

Add a running project

Test 6.

Pagoda mongo cannot start problem: in the pagoda command line into the mongo catalog CD/WWW/server/mongo/bin input command: mongod problem solving, for unknown reasons