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. 【Hadoop学习之四】HDFS HA搭建(QJM)

    环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 jdk8 hadoop-3.1.1 由于NameNode对于整个HDF ...

  2. vim 命令学习(基础篇)

    [1]三种模式 vi的三种模式:命令模式.末行模式.编辑模式. 三种模式相互切换逻辑与命令图: 1.命令模式是vi的默认模式(即每打开一个文件时的初始模式). 2.命令模式切换至末行模式,末行模式切换 ...

  3. mysql 问题:Unknown system variable 'query_cache_size'

    报错:Unknown system variable 'query_cache_size' mysql 的 java 驱动等级比较低,与mysql 数据库不匹配.

  4. Set接口——HashSet集合

    不重复,无索引,不能重复元素,没有索引: HashSet集合: 此时实现Set接口,有哈希表(HashMap的一个实例)支持,哈希表意味着查询速度很快, 是无序的,即元素的存取的顺序可能不一致: 且此 ...

  5. Linux服务器---邮件服务postfix安装

    安装postfix postfix是一个快速.易于管理.安全性高的邮件发送服务,可以配合dovecot实现一个完美的邮箱服务器. 1.安装postfix [root@localhost ~]# rpm ...

  6. java.lang.RuntimeException: can not run elasticsearch as root

    忘写了一个错误: [o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main] org.el ...

  7. POJ 3624 Charm Bracelet (01背包)

    题目链接:http://poj.org/problem?id=3624 Bessie has gone to the mall's jewelry store and spies a charm br ...

  8. multer中间件

    1.Multer是node.js的一个中间件,用于处理multipart/form-data类型的表单数据,它主要用于上传文件.(Multer不会处理任何非multipart/form-data类型的 ...

  9. jetbrain_ia

    在激活Jetbrains旗下任意产品的时候选择激活服务器填入以下地址便可成功激活 http://idea.liyang.io 最新方法(2018.3.4) http://blog.csdn.net/w ...

  10. Python 一些有趣的技巧,包括协程例

    1. 路径操作 比起 os 模块的 path 方法,python3 标准库的 pathlib 模块的 Path 处理起路径更加的容易. ####获取当前文件路径 前提导入 os 和 pathlib 包 ...