Apache HTTP Server

HTTP Server 버전 확인

aappsroot·2014년 5월 19일·조회 3,534

httpd에는 Apache HTTP Server의 버전, 컴파일 옵션, 로드된 모듈 등을 확인할 수 있는 몇 가지 옵션이 있습니다. 배포판이나 설치 방식에 따라 실행 파일 이름이 apache2인 경우도 있으니, 명령이 없다고 나오면 apache2 -v처럼 바꿔서 확인하면 됩니다.

버전과 빌드 정보 확인

1) httpd -v : 버전 번호 확인

$ httpd -v
Server version: Apache/2.2.26 (Unix)
Server built:   Dec 10 2013 22:09:38

-v 옵션은 Apache httpd의 버전과 빌드 일시를 간단히 보여줍니다. 운영 중인 서버의 패치 수준을 빠르게 확인할 때 가장 먼저 사용하는 옵션입니다.

2) httpd -V : 컴파일 설정 확인

$ httpd -V
Server version: Apache/2.2.26 (Unix)
Server built:   Dec 10 2013 22:09:38
Server's Module Magic Number: 20051115:33
Server loaded:  APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
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_FLOCK_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="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/private/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

-V 옵션은 버전뿐 아니라 MPM, 기본 설정 파일 경로, 컴파일 시 적용된 매크로까지 출력합니다. 특히 SERVER_CONFIG_FILE, HTTPD_ROOT, Server MPM 값은 설정 파일 위치나 동작 방식을 확인할 때 유용합니다.

모듈 확인

3) httpd -M : 로드된 모듈 확인

$ httpd -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 authn_file_module (shared)
 authn_dbm_module (shared)
 authn_anon_module (shared)
 authn_dbd_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_groupfile_module (shared)
 authz_user_module (shared)
 authz_dbm_module (shared)
 authz_owner_module (shared)
 authz_default_module (shared)
 auth_basic_module (shared)
 auth_digest_module (shared)
 cache_module (shared)
 disk_cache_module (shared)
 mem_cache_module (shared)
 dbd_module (shared)
 dumpio_module (shared)
 reqtimeout_module (shared)
 ext_filter_module (shared)
 include_module (shared)
 filter_module (shared)
 substitute_module (shared)
 deflate_module (shared)
 log_config_module (shared)
 log_forensic_module (shared)
 logio_module (shared)
 env_module (shared)
 mime_magic_module (shared)
 cern_meta_module (shared)
 expires_module (shared)
 headers_module (shared)
 ident_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 version_module (shared)
 proxy_module (shared)
 proxy_connect_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_scgi_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)
 ssl_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 asis_module (shared)
 info_module (shared)
 cgi_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 imagemap_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 hfs_apple_module (shared)
Syntax OK

-M은 현재 설정을 기준으로 로드되는 모듈 목록을 보여줍니다. 출력에서 (static)은 httpd 바이너리에 정적으로 포함된 모듈이고, (shared)는 설정을 통해 동적으로 로드되는 모듈입니다. 예를 들어 리라이트 규칙이 동작하지 않을 때 rewrite_module이 있는지 확인하는 식으로 활용할 수 있습니다.

4) httpd -l : 컴파일된 정적 모듈 목록 확인

$ httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c

-l은 바이너리에 정적으로 컴파일된 모듈만 보여줍니다. 동적으로 로드되는 공유 모듈까지 확인하려면 위의 -M 옵션을 사용하는 편이 더 정확합니다.

설정 지시어 확인

5) httpd -L : 사용할 수 있는 설정 지시어 목록 확인

httpd -L
,  or 
,  or 
,  or 
,  or 
,  or 
,  or  and in .htaccess
	when AllowOverride includes AuthConfig
AuthName (core.c)
	The authentication realm (e.g. "Members Only")
	Allowed in *.conf only inside ,  or  and in .htaccess
	when AllowOverride includes AuthConfig
Require (core.c)
	Selects which authenticated users or groups may access a protected space
	Allowed in *.conf only inside ,  or  and in .htaccess
	when AllowOverride includes AuthConfig
Satisfy (core.c)
	access policy if both allow and require used ('all' or 'any')
	Allowed in *.conf only inside ,  or  and in .htaccess
	when AllowOverride includes AuthConfig
AddDefaultCharset (core.c)
	The name of the default charset to add to any Content-Type without one or 'Off' to disable
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
AcceptPathInfo (core.c)
	Set to on or off for PATH_INFO to be accepted by handlers, or default for the per-handler preference
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
AccessFileName (core.c)
	Name(s) of per-directory config files (default: .htaccess)
	Allowed in *.conf only outside ,  or 
DocumentRoot (core.c)
	Root directory of the document tree
	Allowed in *.conf only outside ,  or 
ErrorDocument (core.c)
	Change responses for HTTP errors
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
AllowOverride (core.c)
	Controls what groups of directives can be configured by per-directory config files
	Allowed in *.conf only inside ,  or 
Options (core.c)
	Set a number of attributes for a given directory
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes Options
DefaultType (core.c)
	the default MIME type for untypable files
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
FileETag (core.c)
	Specify components used to construct a file's ETag
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
EnableMMAP (core.c)
	Controls whether memory-mapping may be used to read files
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
EnableSendfile (core.c)
	Controls whether sendfile may be used to transmit files
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
Protocol (core.c)
	Set the Protocol for httpd to use.
	Allowed in *.conf only outside ,  or 
AcceptFilter (core.c)
	Set the Accept Filter to use for a protocol
	Allowed in *.conf only outside ,  or 
Port (core.c)
	Port was replaced with Listen in Apache 2.0
	Allowed in *.conf only outside ,  or 
HostnameLookups (core.c)
	"on" to enable, "off" to disable reverse DNS lookups, or "double" to enable double-reverse DNS lookups
	Allowed in *.conf anywhere
ServerAdmin (core.c)
	The email address of the server administrator
	Allowed in *.conf only outside ,  or 
ServerName (core.c)
	The hostname and port of the server
	Allowed in *.conf only outside ,  or 
ServerSignature (core.c)
	En-/disable server signature (on|off|email)
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride isn't None
ServerRoot (core.c)
	Common directory of server-related files (logs, confs, etc.)
	Allowed in *.conf only outside ,  or 
ErrorLog (core.c)
	The filename of the error log
	Allowed in *.conf only outside ,  or 
ServerAlias (core.c)
	A name or names alternately used to access the server
	Allowed in *.conf only outside ,  or 
ServerPath (core.c)
	The pathname the server can be reached at
	Allowed in *.conf only outside ,  or 
Timeout (core.c)
	Timeout duration (sec)
	Allowed in *.conf only outside ,  or 
ContentDigest (core.c)
	whether or not to send a Content-MD5 header with each request
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes Options
UseCanonicalName (core.c)
	How to work out the ServerName : Port when constructing URLs
	Allowed in *.conf anywhere
UseCanonicalPhysicalPort (core.c)
	Whether to use the physical Port when constructing URLs
	Allowed in *.conf anywhere
Include (core.c)
	Name of the config file to be included
	Allowed in *.conf anywhere
LogLevel (core.c)
	Level of verbosity in error logging
	Allowed in *.conf only outside ,  or 
NameVirtualHost (core.c)
	A numeric IP address:port, or the name of a host
	Allowed in *.conf only outside ,  or 
ServerTokens (core.c)
	Determine tokens displayed in the Server: header - Min(imal), OS or Full
	Allowed in *.conf only outside ,  or 
LimitRequestLine (core.c)
	Limit on maximum size of an HTTP request line
	Allowed in *.conf only outside ,  or 
LimitRequestFieldsize (core.c)
	Limit on maximum size of an HTTP request header field
	Allowed in *.conf only outside ,  or 
LimitRequestFields (core.c)
	Limit (0 = unlimited) on max number of header fields in a request message
	Allowed in *.conf only outside ,  or 
LimitRequestBody (core.c)
	Limit (in bytes) on maximum size of request message body
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride isn't None
LimitXMLRequestBody (core.c)
	Limit (in bytes) on maximum size of an XML-based request body
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride isn't None
MaxRanges (core.c)
	Maximum number of Ranges in a request before returning the entire resource, or 0 for unlimited
	Allowed in *.conf anywhere
RLimitCPU (core.c)
	Soft/hard limits for max CPU usage in seconds
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride isn't None
RLimitMEM (core.c)
	Soft/hard limits for max memory usage per process
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride isn't None
RLimitNPROC (core.c)
	soft/hard limits for max number of processes per uid
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride isn't None
LimitInternalRecursion (core.c)
	maximum recursion depth of internal redirects and subrequests
	Allowed in *.conf only outside ,  or 
ForceType (core.c)
	a mime type that overrides other configured type
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
SetHandler (core.c)
	a handler name that overrides any other configured handler
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
SetOutputFilter (core.c)
	filter (or ; delimited list of filters) to be run on the request content
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
SetInputFilter (core.c)
	filter (or ; delimited list of filters) to be run on the request body
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
AddOutputFilterByType (core.c)
	output filter name followed by one or more content-types
	Allowed in *.conf anywhere and in .htaccess
	when AllowOverride includes FileInfo
AllowEncodedSlashes (core.c)
	Allow URLs containing '/' encoded as '%2F'
	Allowed in *.conf only outside ,  or 
PidFile (core.c)
	A file for logging the server process ID
	Allowed in *.conf only outside ,  or 
ScoreBoardFile (core.c)
	A file for Apache to maintain runtime process management information
	Allowed in *.conf only outside ,  or 
LockFile (core.c)
	The lockfile used when Apache needs to lock the accept() call
	Allowed in *.conf only outside ,  or 
MaxRequestsPerChild (core.c)
	Maximum number of requests a particular child serves before dying.
	Allowed in *.conf only outside ,  or 
CoreDumpDirectory (core.c)
	The location of the directory Apache changes to before dumping core
	Allowed in *.conf only outside ,  or 
AcceptMutex (core.c)
	Valid accept mutexes for this platform and MPM are: default, flock, fcntl, sysvsem, posixsem.
	Allowed in *.conf only outside ,  or 
MaxMemFree (core.c)
	Maximum number of 1k blocks a particular childs allocator may hold.
	Allowed in *.conf only outside ,  or 
TraceEnable (core.c)
	'on' (default), 'off' or 'extended' to trace request body content
	Allowed in *.conf only outside ,  or 
Suexec (core.c)
	Enable or disable suEXEC support
	Allowed in *.conf only outside ,  or 
User (prefork.c)
	Effective user id for this server
	Allowed in *.conf only outside ,  or 
Group (prefork.c)
	Effective group id for this server
	Allowed in *.conf only outside ,  or 
ChrootDir (prefork.c)
	The directory to chroot(2) into
	Allowed in *.conf only outside ,  or 
ListenBacklog (prefork.c)
	Maximum length of the queue of pending connections, as used by listen(2)
	Allowed in *.conf only outside ,  or 
Listen (prefork.c)
	A port number or a numeric IP address and a port number, and an optional protocol
	Allowed in *.conf only outside ,  or 
SendBufferSize (prefork.c)
	Send buffer size in bytes
	Allowed in *.conf only outside ,  or 
ReceiveBufferSize (prefork.c)
	Receive buffer size in bytes
	Allowed in *.conf only outside ,  or 
StartServers (prefork.c)
	Number of child processes launched at server startup
	Allowed in *.conf only outside ,  or 
MinSpareServers (prefork.c)
	Minimum number of idle children, to handle request spikes
	Allowed in *.conf only outside ,  or 
MaxSpareServers (prefork.c)
	Maximum number of idle children
	Allowed in *.conf only outside ,  or 
MaxClients (prefork.c)
	Maximum number of children alive at the same time
	Allowed in *.conf only outside ,  or 
ServerLimit (prefork.c)
	Maximum value of MaxClients for this run of Apache
	Allowed in *.conf only outside ,  or 
GracefulShutdownTimeout (prefork.c)
	Maximum time in seconds to wait for child processes to complete transactions during shutdown
	Allowed in *.conf only outside ,  or 
KeepAliveTimeout (http_core.c)
	Keep-Alive timeout duration (sec)
	Allowed in *.conf only outside ,  or 
MaxKeepAliveRequests (http_core.c)
	Maximum number of Keep-Alive requests per connection, or 0 for infinite
	Allowed in *.conf only outside ,  or 
KeepAlive (http_core.c)
	Whether persistent connections should be On or Off
	Allowed in *.conf only outside ,  or 
LoadModule (mod_so.c)
	a module name and the name of a shared object file to load it from
	Allowed in *.conf only outside ,  or 
LoadFile (mod_so.c)
	shared object file or library to load into the server at runtime
	Allowed in *.conf only outside ,  or 

-L은 현재 httpd가 인식하는 설정 지시어와 해당 지시어를 제공하는 모듈을 출력합니다. 설정 파일에서 어떤 지시어를 사용할 수 있는지 확인하거나, 특정 지시어가 어느 모듈에 속하는지 확인할 때 참고할 수 있습니다.

함께 확인하면 좋은 옵션

설정을 수정한 뒤에는 실제로 서비스를 재시작하기 전에 문법 검사를 먼저 실행하는 것이 좋습니다. httpd -t는 설정 파일의 문법을 검사하고 문제가 없으면 Syntax OK를 출력합니다.

$ httpd -t
Syntax OK

정리하면, 단순 버전 확인은 -v, 빌드 옵션과 기본 경로 확인은 -V, 로드된 모듈 확인은 -M, 정적으로 컴파일된 모듈 확인은 -l, 설정 지시어 확인은 -L을 사용하면 됩니다.

댓글 0

로그인 후 댓글을 남길 수 있습니다.

아직 댓글이 없습니다.