Linux-Java项目发布前开启端口

查看已经开启的端口是否有需要的端口

[root@localhost /]# firewall-cmd --list-ports

开启项目需要的端口

[root@localhost /]# firewall-cmd --zone=public --add-port=8080/tcp --permanent

移除不需要的开发端口

[root@localhost /]# firewall-cmd --permanent --remove-port=8080/tcp

重启防火墙、再次查看就有刚才开启的端口

[root@localhost /]# systemctl restart firewalld.service

如果是联系学习的话,可以完全关闭防火墙,毕竟很多的组件都需要使用道端口

# 关闭
systemctl stop firewalld
# 禁止开机启动防火墙
systemctl disable firewalld
posted @ 2021-10-09 10:39  生生灯火半杯月  阅读(149)  评论(0)    收藏  举报