I have hosted my WordPress site on DigitalOcean Droplet along with Cloudflare. I am trying to integrate Ezoic with it. But after integration, I am getting Error 502 whenever I am trying to visit my website. When I contacted Ezoic, they told me that I have to whitelist Ezoic IPs in my host i.e. DigitalOcean. They told me that my connection is a proxy NameServer connection i.e. in my case, my Name Servers are with Cloudflare, and a reverse proxy with Ezoic is present.
Can anyone help in solving this issue because I am new to all this? Can you tell me how to whitelist IPs in DigitalOcean droplet with WordPress?

The server is Apache2

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.

×
1 answer

Hi @hellohello589,

You can whitelist IP addresses on your Droplet using IPTABLES. Good thing is DigitalOcean have a pretty good tutorial on how to work with IPTABLES. Here is the article:

https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands

For instance, if you wish to allow an IP address to your firewall you can se use the following commands

iptables -I INPUT -p tcp -s XXX.XXX.XXX.XXX -j ACCEPT
iptables -I OUTPUT -p tcp -d  XXX.XXX.XXX.XXX -j ACCEPT`

Please note you need to change XXX.XXX.XXX.XXX with the actual IP addresss. Additionally, the above commands will allow access to every port for the given IP Address.

If you want to give access only to IP only on a specific port, you can use

iptables -I INPUT -p tcp -s XXX.XXX.XXX.XXX tcp --dport 80 -j ACCEPT

Regards,
KFSys

by Mitchell Anicas
Iptables is the software firewall that is included with most Linux distributions by default. This cheat sheet-style guide provides a quick reference to iptables commands that will create firewall rules are useful in common, everyday scenarios. This includes iptables examples of allowing and blocking various services by port, network interface, and source IP address.
Submit an Answer