虚拟主机配置 [英] VirtualHost configuration
问题描述
我要在我的Ubuntu PC配置两个基于域名的虚拟主机。如果我键入地址 HTTP:在浏览器// mypage1
,它应该显示我的第一个自定义的HTML页面,如果我输入地址的http:// mypage2
,它应该显示我的第二个自定义的HTML页面。我尝试了以下内容:
I need to configure two name-based virtual hosts in my Ubuntu PC. If I type the address http://mypage1
in browser, it should display my first customized html page and if I type the address http://mypage2
, it should display my second customized html page. I tried out the following:
- 安装了Apache
-
创建了一个文件
mypage1
在站点可用
的内容如下:
<VirtualHost *:80>
ServerName mypage1
ServerAlias http://mypage1
DocumentRoot /var/www/mypage1/html
</VirtualHost>
创建了一个类似的文件 mypage2
在站点可用
做上述步骤,当我输入后 mypage1
在Firefox中,我得到dns_unresolved_hostname错误。
After doing the above steps, when I type mypage1
in firefox, I get dns_unresolved_hostname error.
请帮我如何解决这个问题。
Kindly help me how to resolve this problem.
推荐答案
DNS无法解析的手段正是它说的!它无法找到名为mypage1或mypage2服务器的DNS条目。
DNS unresolved means exactly what it said! It could not find the DNS entries for 'servers' called mypage1 or mypage2.
他们添加到您的/ etc / hosts文件像
Add them to you /etc/hosts file like
127.0.0.1 mypage1 mypage2
如果你成功了,那么你可能会得到不同的错误,那么你就可以开始寻找到虚拟主机配置。
If you are successful then you will probably get a different error, then you can start looking into virtual hosts configuration
这篇关于虚拟主机配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!