![域名无法使用 - VirtualHost 帮助](https://linux22.com/image/523011/%E5%9F%9F%E5%90%8D%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%20-%20VirtualHost%20%E5%B8%AE%E5%8A%A9.png)
Gamer-Source.com 显示不正确,显示的是 Starcraft-Source.com,而不是它自己的网站。有人能指出以下配置的任何问题吗?
cdn.gamer-source.com 也没有显示。
/etc/hosts
127.0.0.1 localhost
127.0.1.1 spireprod
127.0.0.1 www.battle-report.com
127.0.0.1 www.gamer-source.com
127.0.0.1 cdn.gamer-source.com
127.0.0.1 www.seccbiblebowl.org //this domain works 100%
127.0.0.1 www.diablo-source.com
127.0.0.1 www.starcraft-source.com //this works as well
/etc/apache2/sites-available/gamer-source.com
<VirtualHost 64.253.105.250:80>
ServerAdmin [email protected]
DocumentRoot /home/source/public_html/
ServerName www.gamer-source.com
ServerAlias gamer-source.com
ErrorLog /home/source/log/error_log
TransferLog /home/source/log/access_log
</VirtualHost>
<VirtualHost 64.253.105.250:80>
ServerName cdn.gamer-source.com
DocumentRoot /home/source/public_html/cdn/
</VirtualHost>
<VirtualHost 64.253.105.250:80>
ServerName img.gamer-source.com
DocumentRoot /home/source/public_html/img/
</VirtualHost>
# ---------- Starcraft-Source.com -----------
<VirtualHost 64.253.105.250:80>
ServerName www.starcraft-source.com
ServerAlias starcraft-source.com
DocumentRoot /home/source/public_html/starcraft-source/
</VirtualHost>
<VirtualHost 64.253.105.250:80>
ServerName derwish.starcraft-source.com
DocumentRoot /home/source/public_html/derwish/
</VirtualHost>
# ----------- Diablo-Source.com -------------
<VirtualHost 64.253.105.250:80>
ServerName www.diablo-source.com
ServerAlias diablo-source.com
DocumentRoot /home/source/public_html/diablo-source/
</VirtualHost>
更新
这很奇怪,我使用 VIM 修改这些文件。所有其他站点配置文件都显示正确的颜色,其中“ServerAdmin”和“ServerAlias”等单词为青色,各种元素为彩色。我没有看到任何语法错误,还有什么可能导致这种情况?
答案1
您是否启用了上述配置文件?它是否从 /etc/apache2/sites-available/gamer-source.com 链接到 /etc/apache2/sites-已启用/gamer-source.com ?如果是,启用后您是否重新启动了 apache?
你的 apache 配置中是否有 NameVirtualHost 指令?
答案2
如果我不得不猜测,这可能是因为 apache 区分了你的外部 IP 和你的内部 IP;从VirtualHost 页面(请参阅他们的 apache 配置示例页面):
如果有主服务器,则对任何未在指令中指定的地址(例如 localhost)的请求都将转到主服务器。
您可能需要设置您的主机文件以使域使用适当的 IP。