A의 CentOS 7
I 입력 할 때 서버, 나는 다음과 같은 오류가 발생합니다 sudo apachectl restart
내가이 하단에 파일을 포함 추가 한 후 httpd.conf
:
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
그런 다음을 입력 sudo systemctl status httpd.service -l
하면 결과는 다음과 같습니다.
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: failed (Result: exit-code) since Tue 2014-12-23 20:10:37 EST; 2min 15s ago
Process: 2101 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 2099 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 2099 (code=exited, status=1/FAILURE)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
Dec 23 20:10:37 ip-address httpd[2099]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::e23f:49ff:feb7:2a21. Set the 'ServerName' directive globally to suppress this message
Dec 23 20:10:37 ip-address systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Dec 23 20:10:37 ip-address systemd[1]: Failed to start The Apache HTTP Server.
Dec 23 20:10:37 ip-address systemd[1]: Unit httpd.service entered failed state.
apache
include 지시문을 주석 처리하면 다시 시작할 수 있으며 include 지시문의 주석 처리를 제거하여 오류를 다시 만들 수 있습니다. 어떻게 얻을 수 apache
(가) 파일을 포함의 내용을 사용하여 제대로 시작?
맨 아래에 httpd.conf
오류가 발생한 줄은 다음과 같습니다 IncludeOptional sites-enabled/*.conf
. 폴더 .conf
에있는 유일한 파일 은 다음과 같은 내용을 포함하는입니다.sites-enabled
mydomain.com.conf
<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias mydomain.com
DocumentRoot /var/www/mydomain.com/public_html
ErrorLog /var/www/mydomain.com/error.log
CustomLog /var/www/mydomain.com/requests.log combined
</VirtualHost>
(가) httpd.conf
와 함께 사전 설치되어 것과 동일 httpd
하나 개의 라인을 제외하고는, 위의 지시 등이 있습니다. 내가했기 때문에 나는 알고 sudo yum remove httpd mod_ssl
및 sudo yum install httpd mod_ssl
바로이 오류를 발생시킵니다. 이 링크를 클릭하면httpd.conf
파일 공유 사이트에서 전체 를 읽을 수 있습니다 .
이 자습서의 단계를 명시 적으로 수행 할 때이 문제가 발생했습니다 .
포함 파일을 주석 처리 하면에 정의 된에 http/mydomain.com
있는 정적 콘텐츠를 성공적으로 제공합니다 . 문제는 위에 표시된 포함 파일 의 지시문에서 발생한 것 같습니다. 진단을 돕기 위해 EDIT # 3 에 포함 된 세 가지 include 지시문에 포함 된 모든 파일 에 대한 링크를 ./var/www/html
DocumentRoot
httpd.conf
VirtualHost
.conf
httpd.conf
# 1 수정
나는 M32의 조언을하려고하면 변경하는 /etc/hostname
정의 mydomain.com
, apache
아직 다시 시작되지 않으며 systemctl status httpd.service
다음과 같은 결과 :
[sudo_user_account@server-ip-address ~]$ sudo systemctl status httpd.service -l
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: failed (Result: exit-code) since Tue 2014-12-23 14:25:35 EST; 20s ago
Process: 31993 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 31991 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 31991 (code=exited, status=1/FAILURE)
Status: "Total requests: 1; Current requests/sec: 0; Current traffic: 0 B/sec"
Dec 23 14:25:35 hostname systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Dec 23 14:25:35 hostname systemd[1]: Failed to start The Apache HTTP Server.
Dec 23 14:25:35 hostname systemd[1]: Unit httpd.service entered failed state.
# 2 수정
또한 /etc/hosts
다음 이미지에 정의 된대로 내 파일 의 내용을 변경하라는 eyoung100의 조언을 시도했지만 위의 EDIT # 1에서 정의 된 동일한 오류가 여전히 발생합니다.
편집 # 3
DerekC의 요청에 따라 다음을 실행했습니다 sudo apachectl configtest
.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::e23f:49ff:feb7:2a21. Set the 'ServerName' directive globally to suppress this message
Syntax OK
또한 GarethTheRed의 제안에 따라 httpd.conf 의 include 지시문을 조사했습니다 . httpd.conf에 세 가지 include 지시문이 있습니다 . 각 지시문의 폴더에있는 모든 파일과 함께 아래 세 가지를 나열했습니다. 이 .conf
파일 은 모두 httpd
. 아직 수정하지 않았습니다. .conf
아래 링크를 클릭하면 파일 공유 사이트에서 각 파일을 볼 수 있습니다 .
Include conf.modules.d/*.conf
conf.modules.d
디렉토리 에서 다음 파일을 참조합니다 . 00-base.conf
00-dav.conf
00-lua.conf
00-mpm.conf
00-proxy.conf
00-ssl.conf
00-systemd.conf
01-cgi.conf
IncludeOptional conf.d/*.conf
conf.d
디렉토리 에서 다음 파일을 참조합니다 . autoindex.conf
ssl.conf
userdir.conf
welcome.conf
여기서 생략하는 README 파일도 있습니다.
또한 IncludeOptional sites-enabled/*.conf
지침과 그 내용은 위의 OP에 자세히 설명되어 있습니다.
여기에있는 VirtualHost
설정 과 충돌하는 포함 파일 이 mydomain.com.conf
있습니까?
편집 # 4
garethTheRed의 제안 mydomain.com.conf
에 따라 conf.d
디렉토리 로 이동 한 다음 다시 시작할 수있을 mydomain.com.conf
때까지 한 줄씩 주석 처리 httpd
를 시작했습니다. 그런 다음 라인 주석 처리를 시작하여 몇 개의 라인이 남아 있고 httpd
여전히 다시 시작할 수 있는지 확인했습니다 . httpd
다시 시작할 수 있었지만 systemctl status httpd.service -l
동일한 경고가 계속 표시됩니다.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::e23f:49ff:feb7:2a21. Set the 'ServerName' directive globally to suppress this message
VirtualHost
수 있습니다 구문 httpd
은 다음과 같은 (위의 경고를 생성 계속하지만) 시작이다 :
<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias mydomain.com
DocumentRoot /var/www/mydomain.com/public_html
</VirtualHost>
http를 시작할 수 없게 경고를 확대하는 다음 줄을 생략해야했습니다.
# ErrorLog /var/www/mydomain.com/error.log
# CustomLog /var/www/mydomain.com/requests.log combined
또한 나는 달리고 sudo journalctl -xelu httpd
터미널은 다음을 여러 번 반복하여 응답했습니다.
--
-- Unit httpd.service has finished shutting down.
Dec 24 17:48:43 server-ip-address systemd[1]: Stopped The Apache HTTP Server.
-- Subject: Unit httpd.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has finished shutting down.
Dec 24 17:48:48 server-ip-address systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Dec 24 17:48:48 server-ip-address httpd[10364]: AH00558: httpd: Could not reliably d
Dec 24 17:48:48 server-ip-address systemd[1]: Started The Apache HTTP Server.
-- Subject: Unit httpd.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has finished starting up.
--
-- The start-up result is done.
lines 887-909/909 (END)
참고 : 위의 결과는 eyoung100의 호스트 파일을 사용하든 m32의 호스트 파일을 사용하든 동일하게 유지됩니다. 이 질문에 대한 답을 얻으려면 로그 파일을 생성하고 서버 이름 경고를 피할 수 있어야한다고 생각합니다. 그렇지 않으면 httpd 구성의 후속 단계에서 느린 오류가 발생하기 쉽습니다.
apache
웹 사이트의 루트에 쓸 수 없기 때문에 로그로 인해 오류가 발생합니다 . 파일 권한을 수정하더라도 SELinux에 의해 차단됩니다. 이는 단지 수 apache
에 로그를 작성 /var/log/httpd
. 가장 쉬운 해결책은 다른 로그와 구별하기 위해 웹 사이트 이름이 포함 된 파일 이름을 사용하여이 디렉토리에 로그하도록 웹 사이트를 변경하는 것입니다.
ErrorLog /var/log/httpd/mydomain_com_error.log
CustomLog /var/log/httpd/mydomain_com_requests.log combined
서버의 호스트 이름을 설정하고 AH00558 경고를 제거하려면 다음을 사용하십시오.
hostnamectl set-hostname --static <FQDN of your machine>
예 :
hostnamectl set-hostname --static mydomain.com
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다