0

I am very new to MongoDB. Infact, I am new to MEAN Stack. I have successfully installed the MongoDB server on my Mac. After I run the following command:

mongod

the server starts on the port 27017. I try to access the server by entering the localhost URL on the chrome window:

http://127.0.0.1:27017/

I get the following error in the terminal window where the server is running:

SSLHandshakeFailed: SSL handshake received but server is started without SSL support.

To solve this, I googled the error and I tried a few following suggestions from this and this link:

openssl genrsa -des3 -out rootSSL.key 2048 This creates a .key file. Then,

openssl req -x509 -new -nodes -key rootSSL.key -sha256 -days 1024 -out rootSSL.pem This creates a .pem file.

I have even added the .pem file in the System in Keychain Access.

Some links suggested that I should create a server.cnf file, some suggested that I should create a Domain certificate.

Someone also suggested in a question on SO that one should start with Postman, but that is not working either.

Can anybody help me in figuring out this error as all the other suggestions were very confusing and all of them appeared to be beating around the bush.

Code_Ninja
  • 1,729
  • 1
  • 14
  • 38
  • 1
    Why do you've to access MongoDB from browser ? Use some client like robo3T or mongo compass, I would recommend to check (https://medium.com/better-programming/connect-mongodb-database-remotely-using-robo-3t-or-others-mongodb-gui-7a90d5adfa3e) or most preferably (https://stackoverflow.com/questions/28336163/how-to-connect-robomongo-to-mongodb), Also you can take advantage of mongo-atlas (https://www.mongodb.com/cloud/atlas) to create free Mongo database – whoami - fakeFaceTrueSoul Apr 06 '20 at 06:49
  • 1
    You should be looking at some common file which will be usually named as server.js or main.js or index.js & check on which port your code is running on, 27017 is where mongo does run but not the code. If this question is about mongo connectivity issue check the above links.. – whoami - fakeFaceTrueSoul Apr 06 '20 at 06:55

1 Answers1

2

If you are getting this error:

SSLHandshakeFailed: SSL handshake received but server is started without SSL support.

... you are probably accessing https://127.0.0.1:27017/ and not http://127.0.0.1:27017/. Check your spelling.

Also, the HTTP interface doesn't work on recent MongoDB versions. The documentation says:

Changed in version 3.6: MongoDB 3.6 removes the deprecated HTTP interface and REST API to MongoDB.

When I try this on my MongoDB server I get:

% curl http://localhost:27017
It looks like you are trying to access MongoDB over HTTP on the native driver port.

So, beyond verifying that the server has started, accessing it via a web browser is not useful.

D. SM
  • 13,584
  • 3
  • 12
  • 21