私は2つの仮想ホストを持っていますが、Apacheはデフォルトでそのうちの1つになっているようです。
これがホスト#1です。
<VirtualHost *>
ServerName goiclub.com
ServerAlias www.goiclub.com *.goiclub.com
ServerAdmin webmaster@localhost
DocumentRoot /home/casey/public_html/goiclub/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/casey/public_html/goiclub/public>
DirectoryIndex index.php index.htm index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /home/casey/public_html/goiclub/log/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /home/casey/public_html/goiclub/log/access.log combined
ServerSignature On
Alias /doc/ /usr/share/doc/
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
そしてこれは他の仮想ホストです:
<VirtualHost *>
ServerAdmin [email protected]
ServerName geticlub.com
ServerAlias www.geticlub.com *.geticlub.com
DirectoryIndex index.php
DocumentRoot /home/casey/public_html/geticlub/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/casey/public_html/geticlub/public>
DirectoryIndex index.php index.htm index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
LogLevel debug
ErrorLog /home/casey/public_html/geticlub/log/error.log
CustomLog /home/casey/public_html/geticlub/log/access.log combined
</VirtualHost>
goiclub.comとgeticlub.comのどちらを入力しても、「geticlub.com」仮想ホストが返されます。誰かが理由を知っていますか?
また、これは役立つかもしれません:
Sudo Apache2ctl -t -D DUMP_VHOSTS
Apache2: Could not reliably determine the server's fully qualified domain name, using 50.56.118.158 for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:* geticlub.com (/etc/Apache2/sites-enabled/geticlub.com:1)
*:* goiclub.com (/etc/Apache2/sites-enabled/goiclub.com:1)
NameVirtualHostを設定する必要があります。
Ports.confを開き、次を追加します:(最初の<virtualHost>
の上に配置することもできます
NameVirtualHost *:80
Listen 80
ワイルドカードの代わりにIPアドレスを使用することもできます。
仮想ホストは、NameVirtualHostフォーマットとまったく同じフォーマットにする必要があります。
このようにフォーマットされている場合:
NameVirtualHost 1.2.3.4:8080
その場合、vhostは次のようになります。
<VirtualHost 1.2.3.4:8080>