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
- Error connecting to MySQL: Cant connect to MySQL server (10060)
- How to purchase a dedicated server
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
- Centos7 closes and restarts the system firewall and opens firewall ports
- How to block foreign IP access on Linux server?
- Debian system installation yum command
- Several common server port numbers and corresponding services are organized
- What should I do if the cloud storage space is full (solutions for clearing the cloud storage space)
- How to modify the remote port in CentOS 7 and 8