Hi, I have an droplet which is running a NGINX and I wish to block my another droplet running Mongo to be visible exclusively for the NGINX one. Could you help me? Both are running Ubuntu.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Using ufw, first you need to deny all traffic to your database port

sudo ufw deny 3306/tcp

then allow your IP to your server:

sudo ufw allow from Your.IP.Address to any port 3306 proto tcp