找出Apache版本

时间:2020-01-09 14:16:29  来源:igfitidea点击:

我有一个租用的专用LAMP解决方案堆栈服务器。我需要知道我正在运行哪个版本的Apache。如何找到我的Apache服务器版本?如何确定在Linux或Unix等操作系统上使用命令行选项加载的模块?缩写LAMP表示解决方案堆栈的组件完全由自由和开源软件组成,如下所示:

  • Linux的L
  • Apache HTTP Web服务器的A
  • 适用于MySQL或MariaDB数据库管理服务器的M
  • 用于PHP,Perl或Python脚本语言的P

显示Apache httpd Web服务器版本命令

httpd是Apache超文本传输协议(HTTP)服务器程序。
为了找出apache版本使用ssh或控制台登录到服务器。
登录后,执行以下命令以打印httpd版本,然后退出:

# httpd -v

输出示例:

Server version: Apache/2.2.3
Server built:   Oct 28 2008 07:22:45

输出编译到服务器中的模块列表:

# httpd -l

这不会列出使用LoadModule指令包含的动态加载的模块。
要转储已加载的静态模块和共享模块的列表:

# httpd -M

输出示例:

Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
auth_basic_module (shared)
auth_digest_module (shared)
authn_file_module (shared)
authn_alias_module (shared)
authn_anon_module (shared)
authn_dbm_module (shared)
authn_default_module (shared)
authz_host_module (shared)
authz_user_module (shared)
authz_owner_module (shared)
authz_groupfile_module (shared)
authz_dbm_module (shared)
authz_default_module (shared)
ldap_module (shared)
authnz_ldap_module (shared)
include_module (shared)
log_config_module (shared)
logio_module (shared)
env_module (shared)
ext_filter_module (shared)
mime_magic_module (shared)
expires_module (shared)
deflate_module (shared)
headers_module (shared)
usertrack_module (shared)
setenvif_module (shared)
mime_module (shared)
dav_module (shared)
status_module (shared)
autoindex_module (shared)
info_module (shared)
dav_fs_module (shared)
vhost_alias_module (shared)
negotiation_module (shared)
dir_module (shared)
actions_module (shared)
speling_module (shared)
userdir_module (shared)
alias_module (shared)
rewrite_module (shared)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_connect_module (shared)
cache_module (shared)
suexec_module (shared)
disk_cache_module (shared)
file_cache_module (shared)
mem_cache_module (shared)
cgi_module (shared)
version_module (shared)
chroot_module (shared)
perl_module (shared)
php5_module (shared)
proxy_ajp_module (shared)
python_module (shared)
Syntax OK

打印httpd的版本和构建参数,然后退出

输入命令:

# httpd -V

输出示例:

Server version: Apache/2.2.3
Server built:   Oct 28 2008 07:22:45
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-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=128
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"

要查看其他配置设置,请打开httpd.conf文件(通常位于/etc/httpd目录中)。
红帽,CentOS和Fedora将httpd存储在以下位置:

# vi /etc/httpd/conf/httpd.conf

Debian和Ubuntu将apache2.conf文件中的httpd.conf存储在以下位置:

# vi /etc/apache2/apache2.conf

FreeBSD将apache2.2配置存储在以下位置:

# vi /usr/local/etc/apache22/httpd.conf

如果对httpd.conf进行了任何更改,请使用-t选项检查httpd语法是否有错误:

# httpd -t

如果没有错误,只需重新启动Apache Web服务器。