Report this

What is the reason for this report?

Website being copied? Block any other domains from using my server?

Posted on March 22, 2017

Seems someone has set their domain to use my server. It’s not a mirror, the database and everything works and updates with mine. Is there a way to make it so my server will only respond to requests from my domain? He’s basically stealing my content, and he’s showing up on google instead of me.

I’m using node.



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!

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.

@skeddtemp Creating a new answer, since we maxed out the other thread. You should install each service (what you call program), so it’s secure. That would be my recommendation. But you could just setup the firewall to block everything and then open the ports you want accessible from the outside. Have a look at this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-16-04

@hansen - Thanks, appreciate that :-).

@skeddtemp

I’m playing catch-up here, so forgive me if I start on the wrong part.

If you’re simply looking to force MongoDB to listen on localhost or 127.0.0.1, then you need to edit mongodb.conf and change bind_ip to either or.

It’s been a little while since I’ve used MongoDB, though I believe that file is located either here:

/etc/mongodb.conf

or

/etc/mongodb/mongodb.conf

You’d need to run:

nano /etc/mongodb.conf

… or use the other path (if that’s where the config file is) and locate bind_ip and then change it so that it looks like:

bind_ip = 127.0.0.1

or

bind_ip = localhost

You would then need to restart MongoDB.

Once this change is made, as long as all access is local, then I would just remove the firewall rule that applies to MongoDB as you don’t need to allow it in.

To find the rule, you can run:

ufw status numbered

Find the number that shows 27017 and run:

ufw delete NUM

Where NUM is the number you found when running the first command. So, for example, if my rule was number 5 on the list, I’d run:

ufw delete 5

@skeddtemp

I knew I was a little rusty, so the filename is actually mongod.conf. I just spun up a new Droplet and did a quick install of MongoDB 3.4 to confirm.

If the changes you’ve posted are from your the same configuration file, then you definitely shouldn’t see * showing up as that pretty much means MongoDB is listening on 0.0.0.0 which is short for any available IP.

To confirm, I ran the same command on my quick install:

lsof -iTCP -sTCP:LISTEN -P

… which results in:

COMMAND  PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd    1743    root    3u  IPv4  16514      0t0  TCP *:22 (LISTEN)
sshd    1743    root    4u  IPv6  16516      0t0  TCP *:22 (LISTEN)
mongod  4630 mongodb    7u  IPv4  25998      0t0  TCP localhost:27017 (LISTEN)

If you’ve not already, please try running:

service mongod restart

If that doesn’t work, please provide more details on your installation, more specifically how was MongoDB installed?

All I did to install MongoDB (3.4 on Ubuntu 16.04) on my end was run:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.