转载声明:本文转载

原文:https://blog.csdn.net/u013310075/article/details/80983117

关闭与开启防火墙

systemctl stop firewalld.service
systemctl start firewalld.service

先查看防火墙是否开启的状态,以及开放端口的情况:

systemctl status firewalld.service
sudo firewall-cmd --list-all

如下显示,services: dhcpv6-client ssh 表示 ssh 服务是放行的,而 ports: 这里为空,表示无端口号放行。

接下来通过以下命令开放http 80 端口:

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-port=80/tcp --permanent

命令末尾的--permanent表示用久有效,不加这句的话重启后刚才开放的端口就又失效了。

然后重启防火墙:

sudo firewall-cmd --reload

再次查看端口的开放情况:

sudo firewall-cmd --list-all

就会发现 services: 里出现了 http 服务,ports:里也出现了 80 端口:

CentOS-7 开放80端口的更多相关文章

  1. centos 防火墙开放80端口

    辛辛苦苦编译安装完Ngnix,mysql ,PHP,后发现不能访问,后来发现是防火墙把80端口给禁用了.开启之:(以下参考自:http://llhdf.javaeye.com/blog/526176) ...

  2. centos之开放80端口

    #/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT  #/sbin/iptables -I INPUT -p tcp --dport 22 -j ...

  3. centos开放80端口

    增加一条规则 #/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 将更改进行保存 /etc/rc.d/init.d/iptables save 查 ...

  4. CentOS/Linux开放某些端口

    CentOS/Linux开放某些端口 CentOS/Linux 装载系统的时候只开启了少数端口如22,80(有些连80都没有开放)等. 结果再装完Nginx+PHP+MySQL 后不能访问网站. 当然 ...

  5. 阿里云服务器Centos7.4开放80端口的记录

    问题: 阿里云服务器安装的是centos7, 搭建网站安装lnmp1.5后发现访问不了, 不明所以, 在一论坛找到关于80端口未开放的原因. 需求: 开放80端口.于是有了下面第一,二,三部分关于开放 ...

  6. CentOS 7 开放防火墙端口命令

    CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...

  7. CentOS 7 开放防火墙端口

    我:最近在使 CentOS 7时发现在本地不能访问linux上8080端口,以上是我的操作,修改后访问成功 CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现 ...

  8. CentOS 7 开放防火墙端口 命令(转载)

    CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...

  9. CentOS 7 开放防火墙端口 命令

    iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status   # 停止防火墙 service iptables stop   # 启动防火墙 servi ...

  10. linux 安装禅道 和 CentOS 7 开放防火墙端口 命令

    linux 安装禅道链接:  https://www.cnblogs.com/maohuidong/p/9750202.html CentOS 7 开放防火墙端口 命令 链接:https://www. ...

随机推荐

  1. centos 配置vlan

    https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/networking_guide/sec-c ...

  2. Python3解leetcode First Bad Version

    问题描述: You are a product manager and currently leading a team to develop a new product. Unfortunately ...

  3. 20180826(02)-Java集合框架

    Java 集合框架 早在Java 2中之前,Java就提供了特设类.比如:Dictionary, Vector, Stack, 和Properties这些类用来存储和操作对象组. 虽然这些类都非常有用 ...

  4. C语言 | 线段树

    #include<stdio.h> #define MAX_LEN 1000 void build_tree(int arr[],int tree[],int node,int start ...

  5. XML大作业

    XML大作业 共两题,均于实验上机完成 第一题:在xml文档中使用DTD 第二题:掌握使用xsl显示xml文件的基本方法 第一题: 一.实验目的 (1)通过本实验,使学生能够了解并掌握XML DTD的 ...

  6. 微信小程序的开发框架

    wxss:是一套样式语言,用来描述wxml的组件样式:小程序在css基础上做的修改和扩充的版本 css:是一套样式语言,样式表,用来描述xml和html文件样式的呈现: 设备像素:是图片在设备上显示的 ...

  7. Java中POI操作Excel常用方法

    1. https://blog.csdn.net/yjt520557/article/details/82763785 2. https://blog.csdn.net/zxh66/article/d ...

  8. 【TestNG】TestNG使用教程详解

    一.TestNG介绍TestNG是Java中的一个测试框架, 类似于JUnit 和NUnit, 功能都差不多, 只是功能更加强大,使用也更方便.详细使用说明请参考官方链接:https://testng ...

  9. delphi中的idhttpserver如何才能收到idhttp发送来的exe\rar文件呢

    http://zhidao.baidu.com/link?url=-q2oXqYCKBZ9OgFDEHAcQwQEY_NroHcqGvVfKW67X5sF9LdjAAB_HPXQo04VxStFVS7 ...

  10. 网络流强化-HDU4280

    数组没开够居然显示TLE而不是RE,自己觉得好的优化的方法没什么用…… //http://www.renfei.org/blog/isap.html 带解释的 //https://www.cnblog ...