[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 03:05:18 (+0700) | #1 | 274020 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/4a11791c655ba29d3978d655a68516e5.png)
|
blackwidow
Elite Member
|
0 |
|
|
Joined: 12/08/2003 05:55:35
Messages: 581
Offline
|
|
# abc.net virualhost #
<VirtualHost abc.net:80>
ServerAdmin root@localhost
DocumentRoot /home/tiger/www/abc.net/
ServerName abc.net
ServerAlias abc.net
ErrorLog logs/abc.net-error_log
CustomLog logs/abc.net-access_log common
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /home/tiger/www/abc.net/>
Order Allow,Deny
Allow from all
Options -ExecCGI -FollowSymLinks -Indexes
AllowOverride All
</Directory>
</VirtualHost>
# def.com virtualhost #
<VirtualHost def.com:80>
ServerAdmin root@localhost
DocumentRoot /home/tiger/www/def.com/
ServerName def.com
ServerAlias def.com def.net
ErrorLog logs/def.com-error_log
CustomLog logs/def.com-access_log common
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /home/tiger/www/def.com/>
Order Allow,Deny
Allow from all
Options -ExecCGI -FollowSymLinks -Indexes
AllowOverride All
</Directory>
</VirtualHost>
cái này là httpd.conf của mình. mỗi lần restart httpd thì bị Starting httpd: [Mon Mar 11 23:58:57 2013] [warn] VirtualHost abc.net:80 overlaps with VirtualHost def.com:80, the first has precedence, perhaps you need a NameVirtualHost directive
nó báo là một chuyện, mỗi lần vào def.com thì toàn bị trỏ vô trang chủ của abc.net
còn đây là hosts file của mình
xxx.xxx.xxx.xxx abc.net abc def.com def.net
mong các bác giúp |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 07:24:49 (+0700) | #2 | 274021 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/e8375d7a314f90b055b048dbbf80f82b.jpg)
|
mylove14129
Member
|
0 |
|
|
Joined: 27/04/2008 19:07:19
Messages: 106
Offline
|
|
Bạn thay <VirtualHost abc.net:80> và <VirtualHost def.com:80> thành <VirtualHost *:80> |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 07:38:35 (+0700) | #3 | 274023 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/4a11791c655ba29d3978d655a68516e5.png)
|
blackwidow
Elite Member
|
0 |
|
|
Joined: 12/08/2003 05:55:35
Messages: 581
Offline
|
|
mình đã thử cách đó trước khi post ở đây.
Starting httpd: [Tue Mar 12 04:36:45 2013] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
khi vào def.com vẫn bị trỏ vô abc.net |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 07:53:07 (+0700) | #4 | 274025 |
cái <VirtualHost abc.net:80> không cần phải để tên miền đâu, thay cái tên miền là cái IP:80
|
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 08:03:02 (+0700) | #5 | 274028 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/e8375d7a314f90b055b048dbbf80f82b.jpg)
|
mylove14129
Member
|
0 |
|
|
Joined: 27/04/2008 19:07:19
Messages: 106
Offline
|
|
Mình test thử trên host của mình :
Sau khi đổi dòng virtualhost ở trên + thay dòng :
Code:
ServerName def.com
ServerAlias def.com def.net
thành
Code:
ServerName www.def.com
ServerAlias www.def.com www.def.net
ok. Nhưng nếu để như cũ thì đúng là khi truy cập def.com sẽ trỏ sang abc.net |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 08:08:22 (+0700) | #6 | 274029 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/e8375d7a314f90b055b048dbbf80f82b.jpg)
|
mylove14129
Member
|
0 |
|
|
Joined: 27/04/2008 19:07:19
Messages: 106
Offline
|
|
Bạn xem lại cấu hình CNAME(Alias) của domain def.com nhé |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 08:10:03 (+0700) | #7 | 274030 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/4a11791c655ba29d3978d655a68516e5.png)
|
blackwidow
Elite Member
|
0 |
|
|
Joined: 12/08/2003 05:55:35
Messages: 581
Offline
|
|
fuckin weird x_x mình đã thêm www trước domain name, mình chạy centos 6. vẫn bị trỏ vô abc.net x_x
không biết centos ngoài httpd.conf chứa thông tin virtualhost, còn file nào chứa thông tin virualhost không nhỉ? mình nghĩ có cái file nào đó overwrite cái httpd.conf của mình ???
để mình add thêm 1 cái domain thứ 3 rồi tạo thêm 1 virtualhost xem sao ![smilie](/hvaonline/images/smilies/b5e9b4f86ce43ca65bd79c894c4a924c.gif) |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 08:16:18 (+0700) | #8 | 274031 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/e8375d7a314f90b055b048dbbf80f82b.jpg)
|
mylove14129
Member
|
0 |
|
|
Joined: 27/04/2008 19:07:19
Messages: 106
Offline
|
|
Mình cũng đang test trên centos 6 mà, bạn cứ thử thay đổi chỗ www đi. Theo mình chắc chắn nguyên nhân nằm ở đó đấy. Do CNAME(Alias) của www.def.com bạn trỏ về ip của sv trong khi trên sv
Code:
ServerName def.com
ServerAlias def.com def.net
nên nó sẽ trỏ sang abc.net. Theo mình nghĩ nếu bạn thay đổi thứ tự của 2 vituarlhost thì sẽ xảy ra điều ngược lại đấy |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 08:24:02 (+0700) | #9 | 274032 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/4a11791c655ba29d3978d655a68516e5.png)
|
blackwidow
Elite Member
|
0 |
|
|
Joined: 12/08/2003 05:55:35
Messages: 581
Offline
|
|
đã thử
Code:
# abc.net virualhost #
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /home/tiger/www/abc.net/
ServerName www.abc.net
ServerAlias www.abc.net
ErrorLog logs/abc.net-error_log
CustomLog logs/abc.net-access_log common
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /home/tiger/www/abc.net/>
Order Allow,Deny
Allow from all
Options -ExecCGI -FollowSymLinks -Indexes
AllowOverride All
</Directory>
</VirtualHost>
# def.com virtualhost #
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /home/tiger/www/def.com/
ServerName www.def.com
ServerAlias www.def.com www.def.net
ErrorLog logs/def.com-error_log
CustomLog logs/def.com-access_log common
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /home/tiger/www/def.com/>
Order Allow,Deny
Allow from all
Options -ExecCGI -FollowSymLinks -Indexes
AllowOverride All
</Directory>
</VirtualHost>
# hyj.org virtualhost #
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /home/tiger/www/hyj.org/
ServerName www.hyj.org
ServerAlias www.hyj.org
ErrorLog logs/hyj.org-error_log
CustomLog logs/hyj.org-access_log common
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /home/tiger/www/hyj.org/>
Order Allow,Deny
Allow from all
Options -ExecCGI -FollowSymLinks -Indexes
AllowOverride All
</Directory>
</VirtualHost>
vẫn bị |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 08:38:26 (+0700) | #10 | 274035 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/e8375d7a314f90b055b048dbbf80f82b.jpg)
|
mylove14129
Member
|
0 |
|
|
Joined: 27/04/2008 19:07:19
Messages: 106
Offline
|
|
file cấu hình của mình :
Code:
<VirtualHost *:80>
DocumentRoot "/var/www/html/abc.net"
ServerName www.abc.net
ServerAlias www.abc.net abc.net
ErrorLog logs/abc-error_log
CustomLog logs/abc-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/html/def.net"
ServerName www.def.net
ServerAlias www.def.net def.net
ErrorLog logs/def-error_log
CustomLog logs/def-access_log common
</VirtualHost>
Chú ý dòng
Code:
ServerAlias www.def.net def.net
Nhớ xoá cache browser |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 08:56:57 (+0700) | #11 | 274036 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/4a11791c655ba29d3978d655a68516e5.png)
|
blackwidow
Elite Member
|
0 |
|
|
Joined: 12/08/2003 05:55:35
Messages: 581
Offline
|
|
mới vừa thử xong, clear hết cache browser, flushdns... không có gì thay đổi
bạn chạy trên physical server hay vps?
mình có 1 con server 1 con vps, setup y chang như vậy không có vấn đề gì với con server
còn với thằng vps... thì đang bị như trên ![smilie](/hvaonline/images/smilies/274a01ad7ad7ad7d73d5f0b399ae5db2.gif) |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 09:11:40 (+0700) | #12 | 274037 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/e8375d7a314f90b055b048dbbf80f82b.jpg)
|
mylove14129
Member
|
0 |
|
|
Joined: 27/04/2008 19:07:19
Messages: 106
Offline
|
|
mình dùng physical server. Nếu làm đúng như trên mà vẫn không được thì bó tay. |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 12:08:32 (+0700) | #13 | 274040 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/3f44f3018ff71ff4a7d22a98f3babb55.png)
|
quanta
Moderator
|
Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
|
|
Starting httpd: [Mon Mar 11 23:58:57 2013] [warn] VirtualHost abc.net:80 overlaps with VirtualHost def.com:80, the first has precedence, perhaps you need a NameVirtualHost directive
http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost |
|
Let's build on a great foundation! |
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
12/03/2013 23:21:59 (+0700) | #14 | 274057 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/e7c9302fbc4ad04c3a143dec8951a279.jpg)
|
azteam
Member
|
0 |
|
|
Joined: 17/03/2007 21:12:46
Messages: 177
Location: /dev/null
Offline
|
|
Thêm vào httpd.conf 2 dòng
---
NameVirtualHost *
NameVirtualHost <IP>:80
|
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
[Question] nhiều virtualhost trên chung 1 ip, cần giúp |
18/03/2013 02:20:25 (+0700) | #15 | 274145 |
![[Avatar] [Avatar]](/hvaonline/images/avatar/4a11791c655ba29d3978d655a68516e5.png)
|
blackwidow
Elite Member
|
0 |
|
|
Joined: 12/08/2003 05:55:35
Messages: 581
Offline
|
|
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
mặc định bị comment out, mò mẫm 1 hồi, bỏ comment của cái này ra, mọi thứ chạy yên ổn, mất luôn cái warn _default_ VirtualHost overlap on port 80.
còn khai báo virtualhost thì mình để là <VirtualHost *:80>
cám ơn các bác giúp đỡ ^^ |
|
|
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
![](/hvaonline/templates/viet/images/spacer.gif) |
Users currently in here |
1 Anonymous
|
|
Powered by JForum - Extended by HVAOnline
hvaonline.net | hvaforum.net | hvazone.net | hvanews.net | vnhacker.org
1999 - 2013 ©
v2012|0504|218|
|
|