ssl_module은 어디에 로드되며 포트 443에 바인딩할 수 없는 이유는 무엇입니까?

ssl_module은 어디에 로드되며 포트 443에 바인딩할 수 없는 이유는 무엇입니까?

httpd를 시작하려고 하면 다음 오류가 발생합니다.

# service httpd start || journalctl -xn
..
[so:warn] [pid 425] AH01574: module ssl_module is already loaded, skipping
httpd[425]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443
httpd[425]: no listening sockets available, shutting

구문은 괜찮습니다.

# httpd -t
[so:warn] [pid 917] AH01574: module ssl_module is already loaded, skipping
Syntax OK

좋아요 그래서 ssl_module.so두 번로드되었습니다. 하지만 그렇지 않습니다:

# grep -ir ssl_module /etc/httpd/*
/etc/httpd/conf.d/ssl.conf:LoadModule ssl_module modules/mod_ssl.so

또한 포트 443에서 무언가가 수신 대기 중이라는 메시지도 표시됩니다. 하지만 그렇지 않습니다:

# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      336/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      336/sshd

내 httpd 구성에서는 한 번만 수신합니다.

# grep -ir 443 /etc/httpd/*
/etc/httpd/conf.d/ssl.conf:Listen 443
/etc/httpd/conf.d/ssl.conf:<VirtualHost *:443>

아파치가 어떤 서비스도 실행하고 있지 않습니다.

# top -u apache
..
(nothing)

소켓이 이미 사용 중임을 나타내는 경고 및 오류가 있으므로 Apache가 ssl_module.so를 로드하고 포트 443에서 수신 대기하는 다른 conf를 로드하는 것처럼 보입니다.

그런데 문제는..어디인가요?

이는 CentOS Linux 버전 7.2.1511을 실행하는 VPS의 구성입니다.

답변1

문제는 결국 httpd.conf에 중복된 줄이 있어서 ssl.conf가 두 번 로드되는 것이었습니다.

다음 줄이 있습니다.

Include conf.d/*.conf

그리고 더 아래로:

IncludeOptional conf.d/*.conf

첫 번째 항목이 제거되고 문제가 해결되었습니다.

답변2

apache2 -X디버그하는 가장 쉬운 방법은 httpd -X디버그 모드에서 또는 빌드에 따라 터미널 세션에서 서버를 실행하는 것입니다. 이 플래그를 사용하여 자세한 수준을 높일 수 있습니다 -e. 명령 -S플래그는 구성을 덤프합니다. 다른 플래그는 페이지에 설명되어 있습니다 man.

-M플래그는 로드된 모듈을 나열합니다. SSL은 일반적으로 모듈로 제공되며 HTTPS를 활성화하기 전에 로드해야 합니다.

관련 정보