• 【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!

  • 相关阅读:
    CodeForces 734F Anton and School
    CodeForces 733F Drivers Dissatisfaction
    CodeForces 733C Epidemic in Monstropolis
    ZOJ 3498 Javabeans
    ZOJ 3497 Mistwald
    ZOJ 3495 Lego Bricks
    CodeForces 732F Tourist Reform
    CodeForces 732E Sockets
    CodeForces 731E Funny Game
    CodeForces 731D 80-th Level Archeology
  • 原文地址:https://www.cnblogs.com/sylvia-liu/p/3682436.html
Copyright © 2020-2023  润新知