📖
Windows 환경 Apache 2.4 명령어 사용법 총정리 & 서비스 관리 가이드

페이지 정보

본문

Apache 2.4 서버 운영과 관리에 필요한 모든 CMD 명령어를 한 페이지에 정리했습니다.
초보자부터 서버 관리자까지, 서버 점검·재시작·설정 테스트까지 한눈에 확인하고 바로 활용할 수 있습니다.[code]:: ===========================================================
:: Apache 2.4 / Windows 명령어 모음 (상세 주석 포함)
:: ===========================================================

:: 1) Apache 정보 및 문법 검사
C:\Apache24\bin\httpd.exe -v
:: Apache 서버 버전 출력 (예: Apache/2.4.62 Win64)

C:\Apache24\bin\httpd.exe -V
:: Apache 빌드 옵션, 컴파일러 정보 출력

C:\Apache24\bin\httpd.exe -t
:: httpd.conf 문법 검사

C:\Apache24\bin\httpd.exe -S
:: VirtualHost, 포트, 서버명, SSL 상태 확인

C:\Apache24\bin\httpd.exe -l
:: 정적 모듈 목록 확인

C:\Apache24\bin\httpd.exe -L
:: 정의된 디렉터리, 환경 설정 확인

C:\Apache24\bin\httpd.exe -M
:: 로드된 공유 모듈 확인

C:\Apache24\bin\httpd.exe -T
:: 전체 설정 덤프 (문법 포함)

C:\Apache24\bin\httpd.exe -D DUMP_MODULES
:: 모듈 상태 확인

C:\Apache24\bin\httpd.exe -D DUMP_RUN_CFG
:: 런타임 설정 확인

C:\Apache24\bin\httpd.exe -D DUMP_INCLUDES
:: Include 파일 확인

:: 2) Apache 서비스 설치 / 제거 / 제어
C:\Apache24\bin\httpd.exe -k install
:: Apache를 Windows 서비스로 설치

C:\Apache24\bin\httpd.exe -k uninstall
:: Windows 서비스에서 Apache 제거

C:\Apache24\bin\httpd.exe -k start
:: Apache 서비스 시작

C:\Apache24\bin\httpd.exe -k stop
:: Apache 서비스 중지

C:\Apache24\bin\httpd.exe -k restart
:: Apache 서비스 재시작

C:\Apache24\bin\httpd.exe -k graceful
:: 접속 유지하며 Apache 재시작

net start Apache2.4
:: Windows 서비스로 Apache 시작

net stop Apache2.4
:: Windows 서비스로 Apache 중지

sc query Apache2.4
:: Apache 서비스 상태 확인

sc config Apache2.4 start= auto
:: Apache 서비스 자동 시작 설정

sc failure Apache2.4 reset=0 actions=restart/60000
:: 실패 시 60초 후 Apache 자동 재시작

:: 3) 로그 관련
ErrorLog "C:/Apache24/logs/error.log"
:: Apache 에러 로그 위치 지정

CustomLog "C:/Apache24/logs/access.log" combined
:: Apache 접근 로그 위치 지정 (combined 포맷)

LogLevel warn
:: 로그 레벨 설정 (warn 이상 기록)

C:\Apache24\bin\rotatelogs.exe "C:/Apache24/logs/access-%Y-%m-%d.log" 86400
:: access_log 일별 회전

C:\Apache24\bin\rotatelogs.exe -l "C:/Apache24/logs/error-%Y-%m-%d.log" 86400
:: error_log 일별 회전

:: 4) 모듈 관련
LoadModule php_module modules/php8apache2_4.dll
:: PHP 모듈 로드

LoadModule evasive_module modules/mod_evasive.so
:: mod_evasive 모듈 로드

copy "C:\Downloads\mod_evasive.so" "C:\Apache24\modules\mod_evasive.so"
:: 모듈 파일 Apache modules 폴더에 복사

icacls "C:\Apache24\modules\mod_evasive.so" /grant "NT AUTHORITY\SYSTEM:(R)"
:: SYSTEM 권한 부여 (읽기)

icacls "C:\Apache24\modules\mod_evasive.so" /grant "Users:(RX)"
:: Users 권한 부여 (읽기/실행)

dumpbin /EXPORTS "C:\Apache24\modules\mod_evasive.so" | findstr /i evasive
:: 모듈 내 API 구조 확인

:: 5) SSL / 인증서 확인
openssl s_client -connect 127.0.0.1:443 -servername domain.com
:: SSL 연결 테스트

openssl x509 -in "C:\Apache24\certs\server.crt" -text -noout
:: 인증서 내용 확인

:: 6) 프로세스 / 포트 / 네트워크
netstat -ano | find "80"
:: 80번 포트 사용 프로세스 확인

netstat -ano | find "443"
:: 443번 포트 사용 프로세스 확인

tasklist | find "httpd.exe"
:: Apache 프로세스 확인

taskkill /PID <PID> /F
:: 특정 PID 프로세스 강제 종료

ping 127.0.0.1
:: 로컬 서버 연결 테스트

tracert domain.com
:: 도메인까지 경로 추적

nslookup domain.com
:: 도메인 DNS 확인

:: 7) 데이터베이스 서비스 제어
net start MySQL80
:: MySQL80 서비스 시작

net stop MySQL80
:: MySQL80 서비스 중지

sc query MySQL80
:: MySQL80 서비스 상태 확인

sc config MySQL80 start= auto
:: MySQL80 자동 시작 설정

net start MariaDB
:: MariaDB 서비스 시작

net stop MariaDB
:: MariaDB 서비스 중지

:: 8) 파일 / 폴더 / 권한
mkdir "C:\Apache24\logs\mod_evasive"
:: 디렉터리 생성

rmdir /S /Q "C:\Apache24\logs\mod_evasive"
:: 디렉터리 및 내용 삭제

del "C:\Apache24\logs\mod_evasive\*.*"
:: 폴더 내 모든 파일 삭제

type "C:\Apache24\logs\error.log" | more
:: 에러 로그 내용 페이지별 출력

icacls "C:\Apache24\logs" /grant "Everyone:(OI)(CI)F" /T
:: logs 폴더 권한 전체 부여 (재귀 포함)

:: 9) HTTP 요청 / 테스트
curl http://localhost/
:: 로컬 HTTP GET 요청

curl -I http://localhost/
:: 헤더만 요청 (HEAD)

curl -k https://127.0.0.1/ -H "Host: domain.com"
:: SSL + Host 헤더 지정 GET 요청

Invoke-WebRequest -Uri "http://localhost/" -UseBasicParsing
:: PowerShell HTTP 요청

powershell -Command "$h=@{'Host'='domain.com'};Invoke-WebRequest -Uri 'https://127.0.0.1/' -Headers $h -UseBasicParsing"
:: Host 헤더 포함 PowerShell HTTPS 요청

:: 10) 로그 검색 / 실시간 확인 (PowerShell)
Get-Content "C:\Apache24\logs\error-$(Get-Date -Format yyyy-MM-dd).log" -Wait
:: 실시간 로그 모니터링

Select-String -Path "C:\Apache24\logs\error-*.log" -Pattern "evasive","ModEvasive","error" -SimpleMatch
:: 로그 키워드 검색

:: 11) 설정 백업 / 편집
copy "C:\Apache24\conf\httpd.conf" "C:\Apache24\conf\httpd.conf.bak"
:: httpd.conf 백업

notepad "C:\Apache24\conf\httpd.conf"
:: httpd.conf 편집

:: 12) 고급 디버깅 / 단일 프로세스
C:\Apache24\bin\httpd.exe -X
:: 단일 프로세스 모드 (디버깅용)

C:\Apache24\bin\httpd.exe -D FOREGROUND
:: Foreground 실행 (콘솔 모드)

C:\Apache24\bin\httpd.exe -e debug
:: 로그 레벨 debug로 실행

:: 13) 서비스 상태 자동화
sc stop Apache2.4 & sc start Apache2.4
:: Apache 재시작 (단일 명령)

net stop Apache2.4 & net start Apache2.4
:: Apache 재시작 (단일 명령)

:: 14) 기타 유용 명령
where httpd
:: PATH 내 httpd 위치 확인

echo %PATH%
:: 환경 변수 PATH 확인

set | findstr APACHE
:: APACHE 관련 환경 변수 확인

python --version
:: Python 버전 확인

php -v
:: PHP 버전 확인

git --version
:: Git 버전 확인

:: ===========================================================
:: 끝 — Apache2.4 Windows용 모든 주요 명령어 + 상세 설명
:: ===========================================================
[/code]

댓글목록

등록된 댓글이 없습니다.

🔍 검색

회사소개 개인정보처리방침 서비스이용약관
Copyright © rainbowgarden.shop All rights reserved.