[CentOS 7] 아파치 시작 에러, Job for httpd.service failed because the control process exited with error code.

2022. 6. 29. 10:51·🛠 DevOps & Tool/Linux

 

에러

# service httpd start
Redirecting to /bin/systemctl start httpd.service
Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xe" for details.

 

Apache와 Wildfly 연동 과정 중에 tomcat connector 세팅을 마치고 아파치 재시작을 하는 과정에서 에러가 났다.

더보기

2022.06.28 - [공부/Linux] - [CentOS 7] mod_jk를 이용한 Apache-Wildfly 연동

 

[CentOS 7] mod_jk를 이용한 Apache-Wildfly 연동

* JDK와 Apache, Wildfly 각각 설치 완료하여 구동 테스트까지 완료한 이후의 과정입니다. Web Server와 WAS를 연동하기 위한 방법 중의 하나인 mod_jk를 세팅해 보았다. 1. apxs(Apache Extension) 설치 $ yum in..

javacatcher.tistory.com

 

 

# journalctl -xe
--
-- The start-up result is done.
 6월 27 13:37:32 rang sshd[28266]: pam_unix(sshd:session): session opened for us
 6월 27 13:37:42 rang polkitd[632]: Registered Authentication Agent for unix-pro
 6월 27 13:37:42 rang systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
 6월 27 13:37:42 rang httpd[28318]: httpd: Syntax error on line 355 of /etc/http
 6월 27 13:37:42 rang systemd[1]: httpd.service: main process exited, code=exite
 6월 27 13:37:42 rang systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
 6월 27 13:37:42 rang systemd[1]: Unit httpd.service entered failed state.
 6월 27 13:37:42 rang systemd[1]: httpd.service failed.
 6월 27 13:37:42 rang polkitd[632]: Unregistered Authentication Agent for unix-p

 

journalctl -xe  명령어로 로그 데이터를 확인했다.

아파치 실행 중에 실패했다.

 

# cat /var/log/httpd/error_log
[Sun Jun 26 03:31:01.809267 2022] [lbmethod_heartbeat:notice] [pid 4434] AH02282: No slotmem from mod_heartmonitor
[Sun Jun 26 03:31:01.809424 2022] [mpm_prefork:notice] [pid 4434] AH00163: Apache/2.4.6 (CentOS) configured -- resuming normal operations
[Sun Jun 26 03:31:01.809438 2022] [core:notice] [pid 4434] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Mon Jun 27 11:11:20.379204 2022] [mpm_prefork:notice] [pid 4434] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Jun 27 11:11:24.851330 2022] [core:notice] [pid 19129] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Mon Jun 27 11:11:24.852413 2022] [suexec:notice] [pid 19129] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jun 27 11:11:24.852767 2022] [jk:emerg] [pid 19129] Initializing shm:/etc/httpd/logs/mod_jk.shm.19129 errno=13. Unable to start due to shared memory failure.

 

아파치 오류 로그 파일 확인하니 

 

[jk:emerg] [pid 19129] Initializing shm:/etc/httpd/logs/mod_jk.shm.19129 errno=13. Unable to start due to shared memory failure.

 

이 부분이 문제인 것 같다.

엄청 구글링했지만 똑같은 에러를 해결한 분이 거의 없었는데 겨우 발견했다.

 

해결

mod_jk 설정파일을 연다.

 

$ vi /etc/httpd/conf/mod-jk.conf
<IfModule jk_module>

# Where to find workers.properties
JkWorkersFile conf/workers.properties

# the location of jk shared memory
JkShmFile logs/mod_jk.shm

# Where to put jk logs
JkLogFile logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel info

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

JkMountFile conf/uriworkermap.properties

</IfModule>

7번째에 shk 파일이 생성되는 위치인 

JkShmFile logs/mod_jk.shm 이 부분을 JkShmFile run/mod_jk.shm 로 변경해주고 Apache 재시작하면 된다.

 

# the location of jk shared memory
JkShmFile run/mod_jk.shm

 

mod_jk.shm 파일이 정상적으로 생성됨을 확인할 수 있다.

# cd /var/run/httpd/
# ls -al
합계 12
drwx--x---.  3 root   apache  140  6월 27 14:11 .
drwxr-xr-x. 27 root   root    760  6월 27 13:23 ..
-rw-r--r--.  1 root   root      8  6월 27 14:11 authdigest_shm.30392
drwx------.  2 apache apache   40  3월 24 23:58 htcacheclean
-rw-r--r--.  1 root   root      6  6월 27 14:11 httpd.pid
-rw-r--r--.  1 root   root   1024  6월 27 14:45 mod_jk.shm.30392
-rw-r--r--.  1 root   root      1  6월 27 14:11 mod_jk.shm.30392.lock

 

아직도 정확히는 모르겠지만 mod_jk 설정 파일에 정의된 공유 메모리 파일(mod_jk.shm)의 생성 경로에 문제가 있었던 것 같다.

위 메시지에서 errno=13은 `Permission denied`를 의미한다. 이는 공유 메모리 파일을 생성하려는 경로(/etc/httpd/logs/)에 Apache 프로세스가 쓰기 권한이 없다는 것을 나타낸다.

이로 인해 errno=13 (Permission Denied) 오류가 발생하여 Apache가 시작되지 않았던 것 같다.

 

 

 

[참고] https://ethankang.tistory.com/24

저작자표시 비영리 (새창열림)

'🛠 DevOps & Tool > Linux' 카테고리의 다른 글

Ansible - Failed to connect to the host via ssh(인프런 CI/CD 강의 에러)  (0) 2024.03.13
[CentOS 7] mod_jk를 이용한 Apache-Wildfly 연동  (1) 2022.06.28
[CentOS 7] configure: error: C compiler cannot create executables  (1) 2022.06.27
'🛠 DevOps & Tool/Linux' 카테고리의 다른 글
  • Ansible - Failed to connect to the host via ssh(인프런 CI/CD 강의 에러)
  • [CentOS 7] mod_jk를 이용한 Apache-Wildfly 연동
  • [CentOS 7] configure: error: C compiler cannot create executables
현주먹
현주먹
끄적끄적 개발.log
  • 현주먹
    현주먹의 개발로그
    현주먹
  • 전체
    오늘
    어제
    • 전체글 (162)
      • 👶🏻 CS (15)
        • Operating System (8)
        • Database (4)
        • Data Structure (2)
        • Software Engineering (1)
      • 💻 Dev (54)
        • Java & OOP (24)
        • Spring (4)
        • JPA (5)
        • Test Code (1)
        • Database (1)
        • JSP & Servlet (13)
        • Etc (6)
      • 💡 Algorithm (25)
        • 인프런 (9)
        • 백준 (16)
      • 🛠 DevOps & Tool (11)
        • Linux (4)
        • AWS (1)
        • Git (2)
        • Etc (4)
      • 📝 끄적끄적 (57)
        • 후기 및 회고 (5)
        • TDD, 클린 코드 with Java 17기 (3)
        • F-Lab (23)
        • 🖥️ 자바의 정석 (11)
        • 📖 Clean Code (3)
        • 항해99 코테 스터디 (11)
  • 블로그 메뉴

    • 🐈‍⬛ GitHub
    • TIL
  • 인기 글

  • 태그

    PostGreSQL함수
    항해99
    인프런 특정문자뒤집기
    til
    객체지향
    F-Lab
    jsp
    에프랩 후기
    JPA
    TDD 클린 코드 with Java
    데브클럽
    99클럽
    오블완
    오라클
    f-lab 후기
    인프런 단어뒤집기
    개발자취업
    에프랩
    백준10250
    ==와 equals()
    NextSTEP
    티스토리챌린지
    백준
    개발자멘토링
    자바의정석
    로또 미션
    C
    코딩테스트준비
    자바의신절판
    코테스터디
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.2
현주먹
[CentOS 7] 아파치 시작 에러, Job for httpd.service failed because the control process exited with error code.
상단으로

티스토리툴바