반응형

 

 

서버에서 apachectl -k start 또는 httpd 명령으로 Apache를 실행했을 때 아래와 같은 오류가 나오는 경우가 있습니다.

 

 

AH00072: make_sock: could not bind to address 0.0..0:80
(13)Permission denied: AH00072: make_sock: could not bind to address

 

 

이 에러는 Apache가 80번 포트를 열 수 없을 때 발생합니다.

대표적인 원인은 다음과 같습니다 👇

 

 

1️⃣ root 권한이 없어 포트 바인딩 불가

 

리눅스에서는 1024 이하 포트(80, 443 등)를 열려면 root 권한이 필요합니다.

 

✅ 해결 방법

sudo apachectl -k start

 

혹은 root 권한 없이 실행하고 싶다면 아래처럼 실행 파일에 권한을 부여할 수 있습니다.

 

sudo setcap 'cap_net_bind_service=+ep' $(which httpd)

 

💡 which httpd 명령으로 실행 파일 경로를 확인한 후 적용하세요.

 

 

2️⃣ 이미 80번 포트를 다른 프로세스가 사용 중

 

nginx, 기존 Apache 프로세스, 또는 개발용 서버가 80 포트를 점유하고 있을 수 있습니다.

 

✅ 포트 점유 확인

sudo netstat -tuln | grep :80

# 또는

sudo lsof -i :80

 

 

✅ 해결

 1. 점유 중인 프로세스를 종료하거나

 2. Apache 설정 파일(httpd.conf)의 포트를 변경합니다.

sudo vi /etc/httpd/conf/httpd.conf

 

Listen 8080

 

이후 재시작:

sudo apachectl -k restart

 

 



3️⃣ DocumentRoot 권한 부족

 

웹 루트 디렉터리에 Apache 실행 계정(apache, www-data 등)의 권한이 없을 경우 발생합니다.

 

 

✅ Apache 설정 파일 위치 확인

apachectl -V

 

 출력 예시 :

-D HTTPD_ROOT="/etc/httpd"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
  • 설정 파일 전체 경로: $HTTPD_ROOT/$SERVER_CONFIG_FILE
  • 예: /etc/httpd/conf/httpd.conf

✅ 설정 파일에서 DocumentRoot 찾기


설정 파일을 열거나 grep으로 검색:

grep -R "DocumentRoot" /etc/httpd/



출력 예시:

/etc/httpd/conf/httpd.conf:DocumentRoot "/var/www/html"


이 경우 웹 루트 디렉토리는 /var/www/html

• 가상호스트 사용 시에는 /etc/httpd/conf.d/*.conf 또는 /etc/apache2/sites-enabled/*.conf도 확인

 

✅ 권한 수정

sudo chown -R apache:apache /var/www/html
sudo chmod -R 755 /var/www/html

 

 

 

📌 마무리

  • root 권한 없음 sudo apachectl -k start
  • 포트 충돌 netstat / lsof로 확인 후 종료 or Listen 8080
  • 디렉터리 권한 부족 chown / chmod

 

 

🚀 참고 명령어 요약

# Apache 상태 확인

sudo systemctl status httpd

 

# 포트 확인

sudo netstat -tuln | grep :80

 

반응형

+ Recent posts