Apache 显示默认页面 VHOST 页面 [英] Apache Showing Default page VHOST Page

查看:39
本文介绍了Apache 显示默认页面 VHOST 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过这样的虚拟主机添加了一些站点,我还指定了它们的文档路径.我在那里添加了所有内容,但由于某种原因,当我通过浏览器访问该站点时,Apache 默认页面出现了.

I've added some sites through virtual host like this, I have also specified their document route. I added all the content there, but for some reason when I visit the site through the browser the Apache default page is showing up.

<VirtualHost *:80>
    ServerAdmin admin@mydomain.com
    DocumentRoot "/var/www/html/mydomain/public_html"
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    ErrorLog "/var/log/httpd/mydomain/error_log"
    CustomLog "/var/log/httpd/mydomain/access_log" common
</VirtualHost>

如果有人知道出了什么问题,请告诉我!

If anyone has any clue what's wrong, please let me know!

推荐答案

您的 ServerName 是 mydomain.com,但我假设您正在尝试连接到它,并在浏览器上键入localhost".这样 apache 将使用默认的 vhost 而不是你的,这可能是在 /etc/apache/sites-enabled/default 上定义的.

Your ServerName is mydomain.com, but I assume you're trying to connect to it typing "localhost" on your browser. This way apache will use the default vhost instead of yours, which is probably defined on /etc/apache/sites-enabled/default.

您可以做的是将 mydomain.com 设置为指向 localhost.在 Linux 上编辑 /etc/hosts 文件,添加以下行:

What you can do is set mydomain.com to point to localhost. On Linux edit the /etc/hosts file adding the following line:

127.0.0.1   mydomain.com

这篇关于Apache 显示默认页面 VHOST 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆