📖
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]
초보자부터 서버 관리자까지, 서버 점검·재시작·설정 테스트까지 한눈에 확인하고 바로 활용할 수 있습니다.[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]
#이일병[군대사가 메들리] #권윤경 뉴 - 트로트 Ver 5 - 21.내 고향 홍천 #김명수 경음악 2번방-32. 코흘리게 #[자동차노래방 5]-16 눈이 내리네 #백영호 작곡집[`67 0番 上海突破 주제가]-A01.이미자-내이름은 린다이 #삼태기[`09 신 삼태기 메들리 2집]-01 행운을 드립니다 #이종우[`83 그대는 여름 그리고 바람]-A04 그대여 #최용진[`03 라이브] - 13.해후 #아마게돈 - Marie OST #이승민 - 추억
#고은미 1집(너의 향기) - 5. 속 깊은 여자 #김란영 BEST COLLECTION-13. 비처럼 음악처럼 #김란영 가요교실 Vol 5 6-24. 천년을 빌려 준다면 #김용임 옛날노래 1Set 1집 - 17. 울어라 키타줄 #[디지털복원]초원 - HE5 #류영대[` 통일의 노래]-04.고향 #백년설[`79 그리운노래 1]-11.귀국선.이인권 #유상록[전집 06` 컴필 Best]-(196)일어나 #이봉순.김진아.백화연[`06 3인 3색]-17 김진아-우지마라 #이지비(EGB)[`08 7080 CD2]-10 젊은 그대 #이호 작곡집[`70]-B01 두번째 눈물(나훈아) #장윤모[`77 철없던 시절]-B02 명동 나그네(홍경선) #지장원[`10 후회하지 않겠어요[Single]-02 멋진 여자 #최민영[톡쏘는 디스코]2집-13 마포종점 #송춘희 특선집[`76] - B03.도라지 차차차 #임꺽정[97 박범훈작곡]o - 07.여명 #조용필[팝송] - 05 My way(with 신해철) #Sweetbox - 14. This Christmas(Extra Track) #윤건 - 사랑한다면 #젝스키스 4집 - 10 Rigoletto(여자의 마음)
#나운도 명품디스코(테스형 관광가자)-25. 내일가면 안되나요 #변월주[`06 DVD 신곡캬바레]-34.강산아리랑.님아 #서민우 각설이 품바쇼CD2 - 03 닐리리야 #신하림[`71 오해가 남긴것/임성환 작편곡집]-A02 심용일-흙묻은 순정 #유진주 1집[`12 쉬어가는 인생]-03 기다리는 여인 #이도경[흘러간 옛날노래(디스코)CD 2]-A08.용두산 엘레지 #한길로[트롯대장군]B10-흰구름가는길 #한진성[`69 언제나 만날까]-B03 정들면 어떻해(양희) #손정희[`85 이별연습] - A05.타인 #백지영 - 그여자(시크릿 가든 OST)
댓글목록
등록된 댓글이 없습니다.
![]() ![]() |