아파치 httpd 시작 시 오류 해결

나의글·2024년 5월 6일

오류해결

목록 보기
5/5

[root@docker-centos httpd]# systemctl restart httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

다음과 같이 httpd를 시작하려고 하니 에러가 났다.

/var/log/messages 로 로그를 확인해보았더니, 다음과 같은 내용을 확인할 수 있었다.

May 06 23:27:28 docker-centos.example.com systemd[1]: Starting The Apache HTTP Server...
May 06 23:27:28 docker-centos.example.com httpd[10936]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
May 06 23:27:28 docker-centos.example.com httpd[10936]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
May 06 23:27:28 docker-centos.example.com httpd[10936]: no listening sockets available, shutting down
May 06 23:27:28 docker-centos.example.com httpd[10936]: AH00015: Unable to open logs
May 06 23:27:28 docker-centos.example.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 06 23:27:28 docker-centos.example.com systemd[1]: Failed to start The Apache HTTP Server.
May 06 23:27:28 docker-centos.example.com systemd[1]: Unit httpd.service entered failed state.
May 06 23:27:28 docker-centos.example.com systemd[1]: httpd.service failed.

address가 이미 사용되고 있었다는 오류였다.

  1. 일단 먼저 실행중인 httd 프로세스를 모두 강제 종료 시킨다.

    [root@docker-centos httpd]# ps ax | grep httpd | awk '{print $1}' | xargs kill

  2. 그 다음에는 80번 포트 사용하고 있는 pid를 확인한다.

    [root@docker-centos httpd]# netstat -nlp | grep 80
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 8572/nginx: master

n은 호스트 이름과 서비스 이름 대신 IP 주소와 포트 번호를 표시하도록 하고, l은 리스닝하고 있는 소켓을 보여준다. -p는 해당 포트를 사용 중인 프로세스의 PID와 프로그램 이름을 표시한다.

  1. 그 프로세스를 종료한다.

    kill -9 (프로세스 아이디)

  2. httpd 재시작한다. 성공.

profile
기록 velog

0개의 댓글