I have centos7 with virtualmin installed. I wanted to block port 22, so I opened another port (Example 1050) for SSH. This is what I did.
vi /etc/ssh/sshd_config
..changed port 22 to port 1050 for example
yum install firewalld
systemctl unmask firewalld
sudo systemctl start firewalld
sudo firewall-cmd --zone=public --add-port=1050/tcp --permanent
sudo firewall-cmd --reload
service sshd restart
systemctl enable firewalld
All is good as ssh port is working on 1050, but I could not access any websites on server nor was virtualmin loading in browser, but then I realized, I need to add services so I did this:
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
sudo firewall-cmd --zone=public --add-port=10000/tcp --permanent
sudo firewall-cmd --reload
service httpd restart
Now, all is fine. But the problem is I can not access my site when i use prefix "www." It works with just "http" or "https" but not "www" I also have DNS properly pointing "www" to IP address (it was working before installing firewalld)..can you help ?