I wanted to try and link my droplet IP to say Cloudflare, ex mongo.example.com and use port 80 or 2095 on Cloudflare. I want to use Cloudflare STRICT but while setting up the SSL cert and keys I ended up getting lost and overflowed with different instructions. I haven’t been able to find any guide or example. A simple guide or link to a guide or if this is even possible would be nice as I’ve spent way more time on this then I should and want it to be done.
I was able to connect using the IP but not through Cloudflare, even just as a DNS.
I have tried setting my BindIP to a domain, however, this just errors and won’t let mongo start.
Current net config
net:
tls:
mode: allowTLS
certificateKeyFile: /etc/ssl/mongodb.pem
port: 2095
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.
To start, you’ll need to follow these steps:
If you haven’t already, please first install an SSL certificate on your droplet. You can use Let’s Encrypt to get a free SSL certificate. You can follow this guide for securing Nginx with Let’s Encrypt on Ubuntu 20.04 as a reference. Adjust the tutorial as needed for MongoDB and your operating system if it’s different.
Next, make sure MongoDB is configured to use your SSL certificate, listening on the desired port, and allowing connections from Cloudflare IPs. You can find the relevant Cloudflare IP ranges by visiting https://www.cloudflare.com/ips/.
Once everything is set up, you should be able to connect to your MongoDB instance through mongo.example.com using Cloudflare.
For more information on how to set up SSL with MongoDB, refer to the official MongoDB documentation and this DigitalOcean tutorial on configuring SSL/TLS encryption for MongoDB on Ubuntu 20.04.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.