20 May 2016
# 检查配置文件基本语法
/usr/local/apache2/bin/apachectl -t
Syntax OK
# 查看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
# 查看httpd版本 /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命令 # 查看httpd版本及编译选项 httpd -V Server version: Apache/2.4.43 (Unix) Server built: Apr 23 2020 03:04:31 Server\'s Module Magic Number: 20120211:92 Server loaded: APR 1.6.5, APR-UTIL 1.6.1 Compiled using: APR 1.6.5, APR-UTIL 1.6.1 Architecture: 64-bit Server MPM: event threaded: yes (fixed thread count) forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" # 编译参数查看,原理是查看源文件目录中生成的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" \ "$@" # 这个只能是在你自己源码编译的安装方式下查看
# 使用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