zoukankan      html  css  js  c++  java
  • 【Apache系列】linux下Apache的常用操作

    1. 启动/停止

    1.1假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况

       apahce启动命令: /usr/local/apache2/bin/apachectl start   

       apache停止命令: /usr/local/apache2/bin/apachectl stop 

       apache重新启动命令: /usr/local/apache2/bin/apachectl restart

       要在重启 Apache 服务器时不中断当前的连接,则应运行: /usr/local/sbin/apachectl graceful

     

    1.2 如果apache已安装成为linux的服务的话,可以用以下命令操作:

       service httpd start 启动

       service httpd restart 重新启动

       service httpd stop 停止服务

    FAQ


    启动时遇到以下问题

     

    原因分析:apache启动时可能会查询DNS来验证ServerName的配置,没有对服务器域名与本地ip绑定,所以需要对httpd.conf文件进行配置

    解决方案

      1)进入apache配置文件的目录:<apache安装目录>/apache/conf/httpd.conf

      2)编辑httpd.conf文件:

        搜索"#ServerName",添加ServerName <localhost>:<port>

    [root@centos httpd]# vi httpd.conf
    
    #
    # ServerName gives the name and port that the server uses to identify itself.
    # This can often be determined automatically, but we recommend you specify
    # it explicitly to prevent problems during startup.
    #
    # If your host doesn't have a registered DNS name, enter its IP address here.
    #
    #ServerName www.example.com:80

        改为:ServerName <localhost>:<port>  例如:ServerName 192.9.100.242:80

        注意,要去掉开头的 #

      3)再重新启动apache 即可。

        [root@centos httpd]# /usr/local/apache2/bin/apachectl restart

        启动成功啦!   显示    It works!

  • 相关阅读:
    JS中的getter与setter
    Node.js中exports与module.exports的区别
    JS中的匿名函数自执行、函数声明与函数表达式
    JS实现千分位
    JS中的new操作符原理解析
    JS中null与undefined的区别
    JavaScript中callee与caller,apply与call解析
    解决vue路由与锚点冲突
    jQuery中deferred的对象使用
    Vue的生命周期
  • 原文地址:https://www.cnblogs.com/sylvia-liu/p/3682436.html
Copyright © 2011-2022 走看看