zoukankan      html  css  js  c++  java
  • Apache工作模式切换

    一、apache运行模式切换

    apache比较常用的工作模式有worker以及prefork两种方式

    1、编译安装:

    如果在编译时候不指定,系统默认的是prefork模式。如果需要换成worker模式,需要在编译的时候带上编译参数:--with-mpm=worker

    查看apache用的是那种工作模式:在apache安装目录的bin目录下运行:apachectl -l或者httpd -l,如下图:

    从图中可以看出apache是work模式

    2、yum安装:

    yum安装apache默认也是prefork模式,如下图:

    如果需要换成work模式,应该按如下步骤操作

    1、cd /usr/sbin

    2、mv httpd httpd.prefork

    3、mv httpd.work httpd

    4、service httpd restart

    改成work模式后,重启apache可能会报错,如下图:

    解决办法是安装php-zts

    安装完成后再次重启apache不会报错

    再次查看apache运行模式:httpd -l

    二、通过server-status监控性能

    不管是编译安装还是yum安装,操作方法都是一样的,步骤如下:

    1、加载mod_status.so 模块
       在httpd.conf中打开LoadModule status_module modules/mod_status.so

       

    2、添加监听

    在httpd.conf添加如下内容

    <location /server-status> //server-status 这个名字可以任意的取
      SetHandler server-status
      Order Deny,Allow
      Deny from nothing //禁止的访问地址,nothing 表示没有禁止访问的地址
      Allow from all //表示允许的地址访问;all 表示所有的地址都可以访问
    </location>
    ExtendedStatus On //表示的是待会访问的时候能看到详细的请求信息
    <Location /server-info>
      SetHandler server-info
      Order allow,deny
      Deny from nothing
      Allow from all
    </Location>

    3、重启apache

    4、访问

    http://IP地址:端口/server-status

    http://IP地址:端口/server-info

    http://IP地址:端口/server-status ?refresh=N

    N将表示访问状态页面可以每N秒自动刷新一次

    如下图:

    server-status

    server-info

  • 相关阅读:
    c#大文件上传解决方案支持分片断点上传
    css精灵动画
    文字游戏
    利用myeclipse配置数据库连接池
    python 简单的txt文件读写
    数据库连接池配置
    hdu 1030 Delta-wave
    java jdbc sqlhelper
    js实现页面的自动读秒跳转
    购物车模块
  • 原文地址:https://www.cnblogs.com/L-Test/p/9468977.html
Copyright © 2011-2022 走看看