半佛半神仙 發表於 2024-1-9 00:00:00

CentOS7怎么开放8080端口?

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        centos7已经开始使用firewall作为防火墙,而不是iptables了,所以,开放8080端口就和以往不一样了,那么该怎么开放8080端口呢?下面我们就来看看详细的教程。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        1、连接centos7服务器;</p>
<p align="center" style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="CentOS7怎么开放8080端口?" alt="CentOS7怎么开放8080端口?" src="https://zhuji.jb51.net/uploads/img/202305/59b0b730b8b27ae78bf594414863934f.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        2、我们可以输入命令查看防火墙的状态;</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <span><strong>firewall-cmd --state  ;</strong></span></p>
<p align="center" style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="CentOS7怎么开放8080端口?" alt="CentOS7怎么开放8080端口?" src="https://zhuji.jb51.net/uploads/img/202305/3d7af6a7317060e5716b327269a6d754.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        3、如果上一步处于关闭状态,输入命令:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <strong>systemctl start firewalld.service;</strong></p>
<p align="center" style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="CentOS7怎么开放8080端口?" alt="CentOS7怎么开放8080端口?" src="https://zhuji.jb51.net/uploads/img/202305/457da0660d8e02ce513f3f6cee4aebc8.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        4、<strong>开启8080端口</strong>,输入命令:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <span><strong>firewall-cmd --zone=public --add-port=8080/tcp --permanent;</strong></span></p>
<p align="center" style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="CentOS7怎么开放8080端口?" alt="CentOS7怎么开放8080端口?" src="https://zhuji.jb51.net/uploads/img/202305/f0a17eaaf4222bd84ae0925def24a950.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        5、让我们来解释一下上一个命令:</p>
<blockquote>
        <ol class="dp-c">
<li class="alt">
                        <span><span>--zone=</span><span class="keyword">public</span><span>:表示作用域为公共的; </span></span>
</li>
                <li>
                        <span>--add-port=8080/tcp:添加tcp协议的端口8080; </span>
</li>
                <li class="alt">
                        <span>--permanent:永久生效,如果没有此参数,则只能维持当前服务生命周期内,重新启动后失效; </span>
</li>
        </ol>
</blockquote>
<div class="jb51code" style='margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 800px; overflow: hidden; clear: both; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div>
                <div class="syntaxhighlighterxhtml" id="highlighter_383174">
                        <div class="toolbar" style='line-height: 13.2px; margin: 0px !important; padding: 0px !important; outline: 0px !important; border-radius: 0px !important; background: rgb(108, 226, 108) !important; border: none !important; bottom: auto !important; float: none !important; height: 11px !important; left: auto !important; overflow: visible !important; position: absolute !important; right: 1px !important; top: 1px !important; vertical-align: baseline !important; width: 11px !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; min-height: auto !important; z-index: 10 !important; color: white !important;'>
                                <span>?</span>
</div>
                </div>
        </div>
</div>
<p align="center" style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="CentOS7怎么开放8080端口?" alt="CentOS7怎么开放8080端口?" src="https://zhuji.jb51.net/uploads/img/202305/1925cf99e1265938c50bb1892f82853d.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        6、输入命令<strong>重启防火墙</strong>;</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <span><strong>systemctl restart firewalld.service</strong>;</span></p>
<p align="center" style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="CentOS7怎么开放8080端口?" alt="CentOS7怎么开放8080端口?" src="https://zhuji.jb51.net/uploads/img/202305/7740dd53a5b6025b080188975ce61ff7.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        7、输入命令<strong>重新载入配置</strong>;</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <strong>firewall-cmd --reload;</strong></p>
<p align="center" style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="CentOS7怎么开放8080端口?" alt="CentOS7怎么开放8080端口?" src="https://zhuji.jb51.net/uploads/img/202305/4faf13cf4b736f2310d66d7afbd13c4b.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        以上就是centos7开放8080端口的方法,希望大家喜欢,请继续关注服务器之家。</p>
頁: [1]
查看完整版本: CentOS7怎么开放8080端口?