Centos7 使用systemctl 工具操作命令

systemctl 是Centos7的服务管理工具中的主要工具 ,它融合之前service和chkconfig的功能于一体

一、httpd的设置

第一 、 httpd 服务的启动 停止 重启

启动 : systemctl start httpd.service

停止:    systemctl stop httpd.service

重启:     systemctl restart httpd.service

查看httpd 的状态

systemctl status httpd.service

第二、将httpd 服务设置开机启动

设置为开机启动 :  systemctl enable httpd.service

设置开机不启动:   systemctl disable httpd.service

二、防火墙设置

firewalld 打开关闭防火墙端口

1.启动:  systemctl start firewalld

2.查看状态: systemctl status firewalld

3.停止: systemctl stop firewalld

4.禁用:systemctl disable firewalld

使用systemctl命令

启动一个服务:     systemctl start firewalld.service

停止一个服务:     systemctl stop firewalld.service

重启一个服务:    systemctl restart firewalld.service

查看一个服务的状态 :    systemctl status firewalld.service

在开机时启动一个服务:    systemctl enable firewalld.service

在开机时禁用一个服务:    systemctl disable firewalld.service

查看已经启动的服务列表法:  systemctl list-unit-files|grep enabled

查看启动失败的服务: systemctl --failed

配置  firewall-cmd

查看版本:firewall-cmd --version

查看帮助:  firewall-cmd --help

查看状态:  firewall-cmd --state

查看所有打开的端口:  firewall-cmd --zone=public --list-ports

更新防火墙规则: firewall-cmd --reload

查看区域信息: firewall-cmd --get-active-zones

查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
拒绝所有包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic

开启一个端口

firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent 这个参数是永久生效,如果不设置这个参数,默认重启后就失效)

重新载入,使设置剩下

firewall-cmd --reload

查看

firewall-cmd --zone=public --query-port=80/tcp

删除

firewall-cmd --zone=public --remove-port=80/tcp --permanent

CentOS7使用httpd apache 和firewalld打开关闭防火墙与端口的更多相关文章

  1. CentOS7使用firewalld打开关闭防火墙与端口(转载)

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...

  2. 关于学习CentOS7使用firewalld打开关闭防火墙和端口

    1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...

  3. CentOS7使用firewalld打开关闭防火墙与端口(转)

    CentOS7使用firewalld打开关闭防火墙与端口       1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop ...

  4. CentOS7使用firewalld打开关闭防火墙与端口

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld  停止: systemctl disab ...

  5. CentOS7 使用firewalld打开关闭防火墙与端口

    1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status f ...

  6. CentOS7 使用firewalld打开关闭防火墙以及端口

    1.firewalld的基本使用 启动 systemctl start firewalld 关闭 systemctl stop firewalld 查看状态 systemctl status fire ...

  7. CentOS7使用firewalld打开关闭防火墙与端口[转]

    转自:http://www.cnblogs.com/moxiaoan/p/5683743.html1.firewalld的基本使用启动: systemctl start firewalld查看状态: ...

  8. 莫小安 CentOS7使用firewalld打开关闭防火墙与端口

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld  停止: systemctl disab ...

  9. 转 CentOS7使用firewalld打开关闭防火墙与端口

    http://blog.csdn.net/huxu981598436/article/details/54864260 开启端口命令 输入firewall-cmd --query-port=6379/ ...

随机推荐

  1. https://scrapingclub.com/exercise/detail_cookie/

    def parse(self, response): pattern=re.compile('token=(.*?);') token=pattern.findall( response.header ...

  2. Log4j基础知识

    Log4J是Apache的一个开放源代码的项目.通过使用Log4J,程序员可以控制日志信息输送的目的地,包括控制台,文件,GUI组件和NT事件记录器,也可以控制每一条日志的输出格式,或通过定义每一条日 ...

  3. Hive中变量的使用

    1.Hive配置属性 (1)命令行方式 Hive配置属性存储于 hiveconf 命名空间中,该命名空间中的属性是可读写的.在查询语句中插入 '${hiveconf:变量名}',就可以通过 hive ...

  4. 将jar包制作成docker镜像

    将jar包制作成docker镜像1.准备可运行jar包2.建立Dockerfile文件 文件内容: FROM java:8VOLUME /tmpADD xxx-sendemail-0.0.1-SNAP ...

  5. localStorage单页面及不同页面监听变动

    分析 H5本地存储有两个API,一个是Web Storage,还有一个是Web SQL.不管是哪一个,都是基于JavaScript语言来使用,而Web Storage提供了两种存储类型 API:  s ...

  6. 51Nod 1072 威佐夫游戏

    题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1072 有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆 ...

  7. Linux下解析域名命令-dig 命令使用详解

    Linux下解析域名除了使用nslookup之外,开可以使用dig命令来解析域名,dig命令可以得到更多的域名信息.dig 命令主要用来从 DNS 域名服务器查询主机地址信息.dig的全称是 (dom ...

  8. 模板(Template)系统

    一.常用语法 官方文档 只需要记两种特殊符号: {{  }}和 {% %} 变量相关的用{{}},逻辑相关的用{%%}. 1.1变量 {{ 变量名 }} 变量名由字母数字和下划线组成. 点(.)在模板 ...

  9. 如何获取STM32 MCU的唯一ID及应用(转)

    源: 如何获取STM32 MCU的唯一ID

  10. oracle 11g SKIP_UNUSABLE_INDEXES参数

    SKIP_UNUSABLE_INDEXES的作用是在DML期间跳过对索引的维护,这样可以提交DML的效率,可以事后一次性重建,但是SKIP_UNUSABLE_INDEXES=y对unique inde ...