웹사이트 검색

Linux에서 활성화/로드된 Apache 모듈을 확인하는 방법


이 가이드에서는 Apache 웹 서버 프런트엔드와 서버에서 활성화된 Apache 모듈을 나열하거나 확인하는 방법에 대해 간략하게 설명합니다.

Apache는 모듈화 원칙을 기반으로 구축되었으므로 웹 서버 관리자는 다양한 모듈을 추가하여 기본 기능을 확장하고 Apache 성능도 향상시킬 수 있습니다.

권장 읽기: Apache 웹 서버 성능을 향상시키는 5가지 팁

일반적인 Apache 모듈 중 일부는 다음과 같습니다.

  1. mod_ssl – Apache용 HTTPS를 제공합니다.
  2. mod_rewrite – URL 패턴을 정규식과 일치시키고 .htaccess 트릭을 사용하여 투명한 리디렉션을 수행하거나 HTTP 상태 코드 응답을 적용합니다.
  3. mod_security – 무차별 공격이나 DDoS 공격으로부터 Apache를 보호할 수 있는 기능을 제공합니다.
  4. mod_status – Apache 웹 서버 로드 및 페이지 정적을 모니터링할 수 있습니다.

Linux에서는 apachectl 또는 apache2ctl 명령이 Apache HTTP 서버 인터페이스를 제어하는 데 사용되며 이는 Apache의 프런트엔드입니다.

apache2ctl의 사용 정보를 아래와 같이 표시할 수 있습니다.

apache2ctl help
OR
apachectl help
Usage: /usr/sbin/httpd [-D name] [-d directory] [-f file]
                       [-C "directive"] [-c "directive"]
                       [-k start|restart|graceful|graceful-stop|stop]
                       [-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
  -D name            : define a name for use in  directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)
  -S                 : a synonym for -t -D DUMP_VHOSTS
  -t -D DUMP_MODULES : show all loaded modules 
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files

apache2ctlSys V init 모드와 pass-through 모드라는 두 가지 모드에서 작동할 수 있습니다. SysV init 모드에서 apache2ctl은 아래 형식의 간단한 한 단어 명령을 사용합니다.

apachectl command
OR
apache2ctl command

예를 들어, Apache를 시작하고 상태를 확인하려면 일반 사용자인 경우 sudo 명령을 사용하여 루트 사용자 권한으로 다음 두 명령을 실행하십시오.

sudo apache2ctl start
sudo apache2ctl status
tecmint@TecMint ~ $ sudo apache2ctl start
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
httpd (pid 1456) already running
tecmint@TecMint ~ $ sudo apache2ctl status
Apache Server Status for localhost (via 127.0.0.1)

Server Version: Apache/2.4.18 (Ubuntu)
Server MPM: prefork
Server Built: 2016-07-14T12:32:26

-------------------------------------------------------------------------------

Current Time: Tuesday, 15-Nov-2016 11:47:28 IST
Restart Time: Tuesday, 15-Nov-2016 10:21:46 IST
Parent Server Config. Generation: 2
Parent Server MPM Generation: 1
Server uptime: 1 hour 25 minutes 41 seconds
Server load: 0.97 0.94 0.77
Total accesses: 2 - Total Traffic: 3 kB
CPU Usage: u0 s0 cu0 cs0
.000389 requests/sec - 0 B/second - 1536 B/request
1 requests currently being processed, 4 idle workers

__W__...........................................................
................................................................
......................

Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process

통과 모드에서 작동할 때 apache2ctl은 다음 구문의 모든 Apache 인수를 사용할 수 있습니다.

apachectl [apache-argument]
apache2ctl [apache-argument]

모든 Apache 인수는 다음과 같이 나열될 수 있습니다.

apache2 help    [On Debian based systems]
httpd help      [On RHEL based systems]

활성화된 Apache 모듈 확인

따라서 Apache 웹 서버에서 어떤 모듈이 활성화되어 있는지 확인하려면 배포판에 대해 아래 해당 명령을 실행하십시오. 여기서 -t -D DUMP_MODULES는 활성화/로드된 모든 모듈을 표시하는 Apache 인수입니다. :

---------------  On Debian based systems --------------- 
apache2ctl -t -D DUMP_MODULES   
OR 
apache2ctl -M
---------------  On RHEL based systems --------------- 
apachectl -t -D DUMP_MODULES   
OR 
httpd -M
apache2ctl -M
[root@tecmint httpd]# apachectl -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)
....

그게 다야! 이 간단한 튜토리얼에서는 Apache 프런트 엔드 도구를 사용하여 활성화/로드된 Apache 모듈을 나열하는 방법을 설명했습니다. 아래 피드백 양식을 사용하여 이 가이드에 관한 질문이나 의견을 보내실 수 있습니다.