でCentOS 7、私が入力したときに、サーバー、私は次のエラーを取得する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.
apacheincludeディレクティブをコメント化すると再起動できます。includeディレクティブのコメントを外すと、エラーを再作成できます。 インクルードファイルの内容を使用して適切に起動するにはどうすればよいapacheですか?
httpd.confエラーの原因となっているその下の行は次のとおりIncludeOptional sites-enabled/*.confです。フォルダー内の唯一の.confファイルはで、次の内容が含まれています。 sites-enabledmydomain.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がプレインストールされていますものと同じであるhttpd1行を除いては、上記のディレクティブが含まれます。私が知っていたのはsudo yum remove httpd mod_ssl、sudo yum install httpd mod_sslこのエラーをトリガーする直前でしたからです。このリンクをクリックするhttpd.confと、ファイル共有サイトで全体を読むことができます。
このチュートリアルの手順を明示的に実行すると、この問題が発生しました。
インクルードファイルをコメントアウトすると、に定義されhttp/mydomain.comているにある静的コンテンツが正常に提供されます。この問題は、上記のインクルードファイルのディレクティブに起因しているようです。 診断を支援するために、以下のEDIT#3 に、3つのincludeディレクティブに含まれるすべてのファイルへのリンクを含めました。/var/www/htmlDocumentRoothttpd.confVirtualHost.confhttpd.conf
編集#1
/etc/hostname定義するためmydomain.comにm32のアドバイスをしようとすると、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には3つのincludeディレクティブがあります。各ディレクティブのフォルダーにあるすべてのファイルとともに、以下の3つをリストしました。これらはすべて、.confとともにインストールされる標準ファイルですhttpd。まだ変更していません。.conf以下のリンクをクリックして、ファイル共有サイトで各ファイルを表示できます。
Include conf.modules.d/*.confconf.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まで1 行ずつコメントアウトし始めました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のhostsファイルまたはm32のホストファイルのどちらを使用しても同じです。 この質問に答えるためには、ログファイルを作成し、サーバー名の警告を回避できる必要があると思います。 そうしないと、httpdを構成する後続のステップでエラーが残る可能性があります。
apachectl configtest何ですか?
IncludeOptionalオリジナルの終わりにhttpd.confファイル?デフォルトのインストールがあると思います。問題はIncludeOptional、最後に余分なものを追加しているapacheために、含まれている構成ファイルを強制的に2回読み取ってしまい、結果として失敗する可能性があることです。
mydomain.com.confし/etc/httpd/conf.d(他のすべての場所)、削除/etc/httpd/sites-enabled(Debian / Ubuntuのことです)して、IncludeOptionalに追加する必要がありますhttpd.conf。AH00558メッセージは止まらないので、今は無視してかまいませんapache。次にconf、犯人が見つかるまでファイルから行を削除します(または、空の行から始めて、一度に1行ずつ復元します)。
ServerNameディレクティブを追加すると、正確な「曖昧な」エラーが発生しますか?質問に追加してください。