zoukankan      html  css  js  c++  java
  • Linux下启动和停止apache服务

    本文使用的Linux系统为CentOS 7,下面将介绍apache服务的启动、关闭与设置。apache在CentOS 7中一般是默认安装的,而且服务名字为httpd

    1. 安装apache及查看相关配置

    # apache安装命令
    
    $ sudo yum install httpd
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    Package httpd-2.4.6-45.el7.centos.4.x86_64 already installed and latest version
    Nothing to do
    
    
    # 查看apache文件的位置
    
    $ sudo find / -name httpd
    /run/httpd
    /etc/logrotate.d/httpd
    /etc/sysconfig/httpd
    /etc/httpd
    /var/log/httpd
    /var/cache/httpd
    /usr/sbin/httpd
    /usr/lib64/httpd
    /usr/share/httpd
    /usr/include/httpd
    /usr/libexec/initscripts/legacy-actions/httpd

    Apache配置文件位于/etc/httpd/conf,主要的配置文件是/etc/httpd/conf/httpd.conf, apache相关的配置信息都可以在这个文件中看到。

    2. apache服务的启动与关闭

    # 启动服务
    $ sudo systemctl start httpd.service
    
    # 查看服务
    $ ps aux | grep httpd
    root     *  0.3  0.0 220444  4956 ?        Ss   15:46   0:00 /usr/sbin/httpd -DFOREGROUND
    apache   *  0.0  0.0 220444  2492 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
    apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
    apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
    apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
    apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
    
    # 停止服务
    $ sudo systemctl stop httpd.service
    
    # 重启服务
    $ sudo systemctl restart httpd.service
  • 相关阅读:
    破解版sublimeText3重新安装Package Control方法
    javascript中对象的属性的特性
    正则表达式元字符详解
    正则表达式学习笔记
    ExtJs布局大全
    js如何获取select下拉框的value以及文本内容
    ExtJS4之Ext.MessageBox的各种用法
    CODING 代码多仓库实践
    2019 DevOps 必备面试题——容器化和虚拟化
    拥抱微服务,CODING 即将上线单项目多仓库功能
  • 原文地址:https://www.cnblogs.com/azhqiang/p/12096020.html
Copyright © 2011-2022 走看看