Opening HTTP/HTTPS in the firewall
firewalld (AlmaLinux, Rocky Linux, CentOS 7 and later)
Allow inbound connections on ports 80 (HTTP) and 443 (HTTPS):
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
Check the current rules:
firewall-cmd --list-all
ufw (Ubuntu, Debian)
ufw allow 80/tcp
ufw allow 443/tcp
ufw status
iptables
If the server uses iptables directly:
iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
iptables -I INPUT 1 -p tcp --dport 443 -j ACCEPT
Note that iptables rules added this way do not survive a reboot. To make
them permanent, use the iptables-services package on RHEL-like
systems or iptables-persistent on Debian/Ubuntu.