Apache的多域设置 [英] Apache multiple domains setup

查看:206
本文介绍了Apache的多域设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于Linux的Apache 2.2服务器我设立一个pretty简单的问题。我想设置在同一台服务器上的两个完全不同的领域。
但只供从第一标签内容!我搜索计算器和读取Apache.org,但没有运气的项目。

I've got a pretty straightforward issue with a linux based Apache 2.2 server I am setting up. I want to setup two totally different domains on the same server. But it only serves content from the first tag! I've searched StackOverflow and read items at Apache.org but no luck.

我也跟着上Apache.org的指示,把这两部分在我的http.conf文件的底部。

I followed the directions on Apache.org and put these two sections at the bottom of my http.conf file.

<VirtualHost *:80>
    DocumentRoot /var/www/mydomain1
    ServerName sub1.mydomain1.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/mydomain2
    ServerName sub2.mydomain2.com
</VirtualHost>

现在,当我使用浏览器访问: http://sub1.mydomain1.com 谈到了罚款。但是,如果我去 http://sub2.mydomain2.com 我仍然只能得到位于/ var / WWW / webfiles /内容mydomain1。

Now when I use a browser to go to: http://sub1.mydomain1.com it comes up fine. But if I go to http://sub2.mydomain2.com I still only get the content that located in /var/www/webfiles/mydomain1.

我做了很多的明显的事情,如:
- 服务的httpd重新启动
- 我改变了两个条目的顺序,我的httpd.conf并再次,它只会在列表中的第一个。
- 一个支持DOC我用Google说要确保有以下入口点到您的系统上一个有效的域。于是我进入了这个(但它并没有改变任何东西):
服务器名称sub2.mydomain2.com:80

I did many of the obvious things such as: - service httpd restart - I changed the order of the two entries in my httpd.conf and once again, it only serves the first one in the list. - One support doc I had Googled said to make sure to have the following entry point to a valid domain on your system. So I entered this (but it didn't change anything): ServerName sub2.mydomain2.com:80

它必须是一些愚蠢的,但我不能看着办吧!

It must be something silly but I can't figure it out!

推荐答案

好吧,我想通了。这是pretty傻了。我只需要去掉这一行,所以我会实际使用的所有虚拟主机:

Ok, I figured it out. It was pretty silly. I just needed to uncomment this line so I would actually use all the virtual hosts:

NameVirtualHost *:80

这篇关于Apache的多域设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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