Tag Archives: firewall

CentOS 7 – allowing port 80 & 443 httpd



firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent

and then…

firewall-cmd --reload


How to check the zones?

firewall-cmd --get-zones


If you can’t connect to the server/page…

or with curl…

hell:~ pjrfigueiredo$ curl https://www.domain.com
curl: (7) Failed to connect to www.domain.com port 443: Connection refused

Check if anything is listening to 443

sudo netstat -lnp | grep 443

If nothing show up… try to edit the domain httpd configuration file… and make it so, that httpd is listening to it… like for example

<VirtualHost *:80 *:443>




Cloudflare – ban country with .htaccess

One of my clients asked me to BAN an specific country to one of his sites.
Since we have Cloudflare, this is how I made it…

On .htaccess I’v simply added the following lines – on the top of .htaccess -.

SetEnvIf CF-IPCountry IN BuzzOff=1
SetEnvIf CF-IPCountry PT BuzzOff=1
Order allow,deny
Allow from all
Deny from env=BuzzOff

But remember!
Domain/subdomain must have Cloudflare active on DNS settings…