Hot Article
- Centos7 closes and restarts the system firewall and opens firewall ports
- How IID server uses Xshell to connect to Linux (centos) server
- BT panel forgets the background login URL, and the solution to the security entrance verification failure
- The php domain name points to ip, how to use the specified ip address to access a server in the url request domain name in curl mode
- How to purchase a dedicated server
- Error connecting to MySQL: Cant connect to MySQL server (10060)
centos7 open and close 80 port tutorial
- Author:DongYan
- Category:Server Maintain
- Release Time:2023-01-10
1. The centos7 version strengthens the firewall, no longer uses the original iptables, and enables firewall
1. View the opened ports (no ports are opened by default)
firewall-cmd --list-ports
2. Open port 80
firewall-cmd --zone=public (scope) --add-port=80/tcp (port and access type) --permanent (permanent)
3. Restart the firewall
firewall-cmd --reload
4. Stop the firewall
systemctl stop firewalld.service
5. Prohibit firewall startup
systemctl disable firewalld.service
6. Delete
firewall-cmd --zone= public --remove-port=80/tcp --permanent
2. Versions below centos7
1. Open 80, 22, 8080 ports
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
2. Save
/etc/rc.d/init.d/iptables save
3. View open ports
/etc/init.d/iptables status
4. Turn off the firewall
1-Permanent effect, will not be restored after restart
Enable: chkconfig iptables on
Off: chkconfig iptables off
2- Take effect immediately, restore after restart
Open: service iptables start
Close: service iptables stop
related topic
- linux how to change the user password (linux command to change the password)
- How To Install Plesk Panel on Ubuntu 20.04 Server?
- How to solve the Windows 10 prompt "The built-in administrator cannot activate this application"?
- How to modify the remote port in CentOS 7 and 8
- Windows firewall settings only allow specified IPs to access specified ports
- ubuntu 20.04 newbie installation tutorial