Linux에서 Apache 서버 상태 및 가동 시간을 확인하는 3 가지 방법
Apache는 웹 애플리케이션 또는 웹 사이트를 배포하고 실행하기 위해 Linux 및 Unix 플랫폼에서 일반적으로 사용되는 세계에서 가장 널리 사용되는 교차 플랫폼 HTTP 웹 서버입니다. 중요한 것은 설치가 쉽고 구성도 간단하다는 것입니다.
이 기사에서는 아래에 설명 된 다양한 방법/명령을 사용하여 Linux 시스템에서 Apache 웹 서버 가동 시간을 확인하는 방법을 보여줍니다.
1. Systemctl 유틸리티
Systemctl은 systemd 시스템 및 서비스 관리자를 제어하는 유틸리티입니다. 서비스를 시작, 다시 시작, 중지하는 데 사용됩니다. systemctl status 하위 명령은 이름 state가 서비스 상태를 보는 데 사용되므로 위의 목적으로 다음과 같이 사용할 수 있습니다.
$ sudo systemctl status apache2 #Debian/Ubuntu # systemctl status httpd #RHEL/CentOS/Fedora

2. Apachectl 유틸리티
Apachectl은 Apache HTTP 서버용 제어 인터페이스입니다. "이 방법을 사용하려면 mod_status (가동 시간을 포함하여 서버가 수행중인 정보를 표시) 모듈이 설치 및 활성화되어 있어야합니다 (기본 설정).
server-status 구성 요소는 /etc/apache2/mods-enabled/status.conf 파일을 사용하여 기본적으로 활성화됩니다.
$ sudo vi /etc/apache2/mods-enabled/status.conf

서버 상태 구성 요소를 활성화하려면 아래 파일을 만드십시오.
# vi /etc/httpd/conf.d/server-status.conf
다음 구성을 추가하십시오.
<Location "/server-status"> SetHandler server-status #Require host localhost #uncomment to only allow requests from localhost </Location>
파일을 저장하고 닫습니다. 그런 다음 웹 서버를 다시 시작하십시오.
# systemctl restart httpd
주로 터미널을 사용하는 경우 lynx 또는 링크와 같은 명령 줄 웹 브라우저도 필요합니다.
$ sudo apt install lynx #Debian/Ubuntu # yum install links #RHEL/CentOS
그런 다음 아래 명령을 실행하여 Apache 서비스 가동 시간을 확인하십시오.
$ apachectl status

또는 아래 URL을 사용하여 그래픽 웹 브라우저에서 Apache 웹 서버 상태 정보를 볼 수 있습니다.
http://localhost/server-status OR http:SERVER_IP/server-status
3. ps 유틸리티
ps는 Linux 시스템에서 실행중인 활성 프로세스의 선택에 관한 정보를 보여주는 유틸리티이며 grep 명령과 함께 사용하여 다음과 같이 Apache 서비스 가동 시간을 확인할 수 있습니다.
여기에서 플래그 :
-e
– enables selection of every processes on the system.-o
– is used to specify output (comm – command, etime – process execution time and user – process owner).
# ps -eo comm,etime,user | grep apache2 # ps -eo comm,etime,user | grep root | grep apache2 OR # ps -eo comm,etime,user | grep httpd # ps -eo comm,etime,user | grep root | grep httpd
아래의 샘플 출력은 apache2 서비스가 4 시간 10 분 28 초 동안 실행되었음을 보여줍니다 (루트에서 시작한 서비스 만 고려).

마지막으로 더 유용한 Apache 웹 서버 가이드를 확인하세요.
- 13 Apache Web Server Security and Hardening Tips
- How to Check Which Apache Modules are Enabled/Loaded in Linux
- 5 Tips to Boost the Performance of Your Apache Web Server
- How to Password Protect Web Directories in Apache Using .htaccess File
이 기사에서는 Linux 시스템에서 Apache/HTTPD 서비스 가동 시간을 확인하는 세 가지 방법을 보여주었습니다. 공유 할 질문이나 생각이 있으면 아래 댓글 섹션을 통해 수행하십시오.