linux's docs

21.3.0: LAMP-APACHE状态查看


0. 配置状态查看

# 检查配置文件基本语法
/usr/local/apache2/bin/apachectl -t
Syntax OK

1. 模块状态查看

# 查看shared模块和static模块
/usr/local/apache2/bin/apachectl -M
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_worker_module (static)
 ......

# 查看编译在apache中的一些modules,可看出运行模式
/usr/local/apache2/bin/apachectl -l
Compiled in modules:
  core.c
  mod_so.c
  http_core.c
  worker.c

2. APACHE版本及编译参数查询

/usr/local/apache2/bin/apachectl -v
Server version: Apache/2.4.20 (Unix)
Server built:   May 23 2016 03:26:12

/usr/local/apache2/bin/httpd -v
Server version: Apache/2.4.20 (Unix)
Server built:   May 23 2016 03:26:12
# 效果一样,是因为apachectl本身调用的就是httpd命令

# 编译参数查看,原理是查看源文件目录中生成的config.nice文件
cat /usr/local/src/httpd-2.4.20/config.nice
#! /bin/sh
#
# Created by configure

"./configure" \
"--prefix=/usr/local/apache2" \
"--with-apr=/usr/local/apr" \
"--with-apr-util=/usr/local/apr/bin/apu-1-config" \
"--enable-rewrite" \
"--enable-so" \
"--enable-headers" \
"--enable-expires" \
"--with-mpm=worker" \
"--enable-modules=most" \
"--enable-deflate" \
"$@"

3,apache服务启动关闭

# 使用apachectl命令(其实是个脚本,调用的httpd命令)
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl restart
/usr/local/apache2/bin/apachectl graceful

Contents