0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Apache バーチャルホスト httpd -S のエラーを解消する

Posted at

バーチャルホストをApacheで設定している場合に使える便利なコマンド・

httpd -S

バーチャルホストの設定を確認できます。

〇〇のドメインのリダイレクトしてほしいんだけど、
の依頼があるも、どこがドメインのルートなのかわからない。
そもそも、バーチャルホストの設定ファイルってどこ?
前任者がやめてわからないよー

と困った状態を助けてくれたコマンドです。

環境
・CentOS7
・Apache2.4
・名前ベースのバーチャルホスト

その時に2つエラーメッセージが表示されました。
サイトはすべて表示されているので大きな間違いではないでせようが、今後謎エラーで苦しむのを回避するために、解決しておきます。

エラー1

NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf/httpd.conf:43

エラー2

httpd: Could not reliably determine the server's fully qualified domain name, using 〇〇〇〇 Set the 'ServerName' directive globally to suppress this message

エラー1 NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf/httpd.conf:43

について

グーグル翻訳の結果は

NameVirtualHostは効果がなく、次のリリースで削除される予定です/etc/httpd/conf/httpd.conf:43

要するにいらないってこと
なので、
エラーメッセージの通り、
etc/httpd/conf/httpd.confの43行目

NameVirtualHost *:80をコメントアウトしました。

ついでに
44行目に
NameVirtualHost *:443もあったのでこちらもコメントアウトしました。

これで1つ目のエラーは解消

エラー2  httpd: Could not reliably determine the server's fully qualified domain name, using 〇〇〇〇 Set the 'ServerName' directive globally to suppress this message

グーグル翻訳してみます。

httpd:サーバーの完全修飾ドメイン名を確実に特定できませんでした。「ServerName」ディレクティブをグローバルに設定して、このメッセージを抑制してください

そこで
/etc/httpd/conf/httpd.conf のServerNameの箇所を探してみます。
すると
ServerNameの箇所がコメントアウトされています。

そこで
コメントをはずして

ServerName IPアドレス

にしたところ、
エラーメッセージは消えました。

今回はバーチャルホストを使っているので
ServerName IPアドレスにしましたが、
1つしかドメインを使っていない場合は、
ServerName ドメイン名
になるようです。

めでたし
めでたし

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?