
誰か、私が何を間違っているのか教えてもらえますか。Apache 2.4 を実行しているサーバーが 1 台あり、その中に 3 つの VirtualHosts があり、次のように設定されています。
<VirtualHost helpedsk.example.com:80>
ServerAdmin [email protected]
DocumentRoot "${SRVROOT}/htdocs/hesk"
ServerName helpdesk.example.com
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
<Directory "${SRVROOT}/htdocs/hesk">
Require all granted
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost wiki.example.com:80>
ServerAdmin [email protected]
DocumentRoot "${SRVROOT}/htdocs/dokuwiki"
ServerName wiki.example.com
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
<Directory "${SRVROOT}/htdocs/dokuwiki">
Require all granted
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost docs.example.com:80>
ServerAdmin [email protected]
DocumentRoot "${SRVROOT}/htdocs/drupal"
ServerName docs.example.com
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
<Directory "${SRVROOT}/htdocs/drupal">
Require all granted
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
しかし、何らかの理由で最後のものだけが機能し、最初のものはサーバーのドキュメント ルート (hesk なし) を表示し、2 番目のものはそれ自体への無制限のリダイレクトに入り、その理由がわかりません。2 番目のものは、後で変更できるサーバー ip/dokuwiki を指すように設定したためである可能性がありますが、最初のものは hesk にならないのはなぜですか?
これらのサイトはすべて、serverip/site を使用してアクセスすると正常に機能しますが、名前でアクセスしようとすると、最後のサイトのみが機能します。
答え1
気にしないでください。VirtualHost のすべての行を *:80 に変更し、ServerName をサイト URL のままにしておいたら、今は動作するようになりました。