为什么我的apache虚拟主机设置不生效?

由 jxwaxqb 在 05-20-2004 19:38 发表:

为什么我的apache虚拟主机设置不生效?

有两个虚拟主机,但输IP和两个域名显示的都是第一个网站。配置如下:

NameVirtualHost 192.168.0.1

1<virtualhost 192.168.0.1="">   
2  
3DocumentRoot /usr/local/apache/htdocs   
4  
5ServerName 192.168.0.1   
6  
7DirectoryIndex index.htm index.html   
8  
9</virtualhost>
 1<virtualhost 192.168.0.1="">   
 2  
 3ServerAdmin [email protected]   
 4  
 5DocumentRoot /usr/local/apache/htdocs   
 6  
 7ServerName customer.china.com   
 8  
 9DirectoryIndex index.html index.htm   
10  
11</virtualhost>
 1<virtualhost 192.168.0.1="">   
 2  
 3ServerAdmin [email protected]   
 4  
 5DocumentRoot /usr/local/apache/htdocs/ddn   
 6  
 7ServerName ddn.china.com   
 8  
 9DirectoryIndex index.php   
10  
11</virtualhost>

我爱Cisco,我更爱Linux。


由 linuxuser 在 05-20-2004 19:54 发表:


ServerName 192.168.0.1

用名字

所有的网址都是虚拟的了,不能用ip


由 jxwaxqb 在 05-20-2004 20:01 发表:


我试过,和这没关系的。

其实ServerName 192.168.0.1这一段相当于IIS中的默认web站点。


我爱Cisco,我更爱Linux。


由 dato 在 05-21-2004 00:28 发表:


NameVirtualHost 192.168.1.3

1<virtualhost 192.168.1.3="">   
2  
3ServerName forum.minidns.net   
4  
5DocumentRoot x:/w3/www/forum   
6  
7</virtualhost>
1<virtualhost 192.168.1.3="">   
2  
3ServerName dato.minidns.net   
4  
5DocumentRoot x:/w3/www/mambo   
6  
7</virtualhost>
1<virtualhost 192.168.1.3="">   
2  
3ServerName plnn.minidns.net   
4  
5DocumentRoot x:/w3/www   
6  
7</virtualhost>

由 dato 在 05-21-2004 00:36 发表:


我的网络是由ADSL modem内置的NAT协议端口映射实现的

由动态DNS提供商将plnn.minidns.net映射于上网的动态IP

然后通过RDR端口映射于内网的机器,刚才没仔细看,暂时没想到原因


http://dato.minidns.net

Webmasterworld -- the next person you help may just be yourself!


由 jxwaxqb 在 05-21-2004 15:00 发表:


我觉得这段配置应该没问题。

但是错误在哪儿呢?请教高手。


我爱Cisco,我更爱Linux。


由 myym 在 05-21-2004 17:34 发表:


apache中不论是基于ip还是名字的虚拟主机,我都没成功过,我也自信配制没问题,这个问题很怪,在mandrake和redhat下都不行,谁能好好讲讲这个问题


由 myym 在 05-21-2004 17:37 发表:


我的虚拟主机有时开后,主服务器就打不开,麻烦,所以现在我不在作虚拟主机,而是用个人空间来代替


由 此用户还没注册 在 05-22-2004 14:26 发表:


基于IP的虚拟主机,要为网卡绑定多一个IP吧!?


我是一只小小鸟,飞呀飞呀飞不高~~```


由 7dehao 在 05-22-2004 16:19 发表:


  1&lt;virtualhost 192.168.1.3=""&gt;   
  2  
  3必须把里面的ip改成域名,否则虚拟主机失效,具体的原因在   
  4  
  5#man httpd   
  6  
  7里有说明。 
  8
  9__________________   
 10  
 11提问时,请你附上相关硬件的型号或牌子,linux发行版、软件的名称和版本。   
 12  
 13提问前,如果有可能的话,你最需要做的就是把出错信息和相关的日志信息贴上来。   
 14  
 15当然,我们十分期望你能浏览一下置顶贴里的内容。 
 16
 17  
 18
 19
 20* * *
 21
 22  
 23_由 jxwaxqb 在 05-22-2004 20:39 发表:_   
 24  
 25
 26
 27****
 28
 29  
 30  
 31
 32
 33晕。今天无意之间发现问题所在了。   
 34  
 35其实我的配置是没有问题的!问题在我的虚拟主机配置部分是copy过来的,其他部分改了,但忘了改ServerName后面的域名了。   
 36  
 37看来做事还是不够认真啊。 
 38
 39__________________   
 40  
 41我爱Cisco,我更爱Linux。 
 42
 43  
 44
 45
 46* * *
 47
 48  
 49_由 ruochen 在 05-22-2004 20:45 发表:_   
 50  
 51
 52
 53**回复: 为什么我的apache虚拟主机设置不生效?**
 54
 55  
 56  
 57
 58
 59&amp;gt; quote: 
 60&amp;gt; 
 61&amp;gt; * * *
 62&amp;gt; 
 63&amp;gt; _最初由 jxwaxqb 发表_   
 64&amp;gt;    
 65&amp;gt;  **有两个虚拟主机,但输IP和两个域名显示的都是第一个网站。配置如下:  
 66&amp;gt;    
 67&amp;gt;  NameVirtualHost 192.168.0.1   
 68&amp;gt;    
 69&amp;gt;    
 70&amp;gt;    
 71&amp;gt;  &lt;virtualhost 192.168.0.1=""&gt;   
 72&amp;gt;    
 73&amp;gt;  DocumentRoot /usr/local/apache/htdocs   
 74&amp;gt;    
 75&amp;gt;  ServerName 192.168.0.1   
 76&amp;gt;    
 77&amp;gt;  DirectoryIndex index.htm index.html   
 78&amp;gt;    
 79&amp;gt;  &lt;/virtualhost&gt;   
 80&amp;gt;    
 81&amp;gt;    
 82&amp;gt;    
 83&amp;gt;  &lt;virtualhost 192.168.0.1=""&gt;   
 84&amp;gt;    
 85&amp;gt;  ServerAdmin [email protected]   
 86&amp;gt;    
 87&amp;gt;  DocumentRoot /usr/local/apache/htdocs   
 88&amp;gt;    
 89&amp;gt;  ServerName customer.china.com   
 90&amp;gt;    
 91&amp;gt;  DirectoryIndex index.html index.htm   
 92&amp;gt;    
 93&amp;gt;  &lt;/virtualhost&gt;   
 94&amp;gt;    
 95&amp;gt;  &lt;virtualhost 192.168.0.1=""&gt;   
 96&amp;gt;    
 97&amp;gt;  ServerAdmin [email protected]   
 98&amp;gt;    
 99&amp;gt;  DocumentRoot /usr/local/apache/htdocs/ddn   
100&amp;gt;    
101&amp;gt;  ServerName ddn.china.com   
102&amp;gt;    
103&amp;gt;  DirectoryIndex index.php   
104&amp;gt;    
105&amp;gt;  &lt;/virtualhost&gt; **
106&amp;gt; 
107&amp;gt; * * *
108
109  
110  
111  
112  
113  
114  
115customer.china.com   
116  
117ddn.china.com   
118  
119不一样呀!是什么地方的ServerName?? 
120
121__________________   
122  
123samaung753dfx+msikt333+duron1.2+128ram+GF2 400+st60G+ecom+samsung52cdrom   
124  
125+rt8139   
126  
127winxp+2000server+freebsd5.1+fedora1.0+debian3.0   
128
129
130  
131
132
133* * *
134
135  
136_由 temptation 在 05-24-2004 13:47 发表:_   
137  
138
139
140****
141
142  
143  
144
145
146改成这样试试,应该可以的.有什么问题请回复   
147  
148NameVirtualHost 192.168.0.1   
149  
150  
151  
152&lt;virtualhost customer.china.com=""&gt;   
153  
154ServerAdmin [email protected]   
155  
156DocumentRoot /usr/local/apache/htdocs   
157  
158ServerName customer.china.com   
159  
160ServerAlias customer   
161  
162DirectoryIndex index.html index.htm   
163  
164&lt;/virtualhost&gt;
165&lt;virtualhost ddn.china.com=""&gt;   
166  
167ServerAdmin [email protected]   
168  
169DocumentRoot /usr/local/apache/htdocs/ddn   
170  
171ServerName ddn.china.com   
172  
173ServerAlias dd&lt;/virtualhost&gt;&lt;/virtualhost&gt;
Published At
Categories with 服务器类
comments powered by Disqus