Bang hộiTiền mặt: 0 Xu Trò chơiHộp quà giáng sinhThứ Năm, 08:24:16 - 25/04/2024
Chia sẻ kiến thức sử dụng VPS (máy chủ ảo) - Server (máy chủ riêng)

Các điều hành viên: Mod, SMod, Admin

[Apache] Creat domain to directory - Dns domain vào thư mục vps

[Apache] Creat domain to directory - Dns domain vào thư mục vps

#1 » Gửi bài gửi bởi nghiatichxanh1992 » 10/05/2014 16:46 » @321403

Apache: [warn] _default_ VirtualHost overlap on port 80, the first has precedence Error and Solution

Question: I'm using Apache 2 to host multiple site on a single host using Apache name based VirtualHost feature. However, Apache is displaying lots of warning as follows:

Mã: Chọn tất cả
Performing sanity check on apache22 configuration:
[Portal Oct 05 06:59:34 2008] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Portal Oct 05 06:59:34 2008] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Portal Oct 05 06:59:34 2008] [warn] NameVirtualHost 81.aaa.www.yyy:80 has no VirtualHosts
Syntax OK
Stopping apache22.
Waiting for PIDS: 14968.
Syntax OK
Starting apache22.
[Portal Oct 05 06:59:36 2008] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Portal Oct 05 06:59:36 2008] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Portal Oct 05 06:59:36 2008] [warn] NameVirtualHost 81.aaa.www.yyy:80 has no VirtualHosts


How do I fix this warning and host multiple websites under UNIX / Linux Apache 2 webserver?

Answer: The NameVirtualHost directive is a required to configure name-based virtual hosts. Add this to your httpd.conf file to fix this issue. Open httpd.conf file:
Mã: Chọn tất cả
# vi /etc/httpd/conf/httpd.conf


Add NameVirtualHost as follows:
Mã: Chọn tất cả
NameVirtualHost *:80


OR add server IP:
Mã: Chọn tất cả
NameVirtualHost 202.54.1.1:80


Save and close the file. Restart httpd web server under RHEL / Red Hat / Fedora / CentOS Linux:
Mã: Chọn tất cả
# service httpd restart


OR type the following to restart Apache 2 under Debian / Ubuntu Linux:

Sample Apache 2 Virtual hosting configuration:

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.

Mã: Chọn tất cả
# My Virtual Hosts Config File for Two Domains

NameVirtualHost *:80
 
<VirtualHost *:80>
    ServerAdmin webmaster@theos.in
    DocumentRoot "/usr/local/docs/theos.in"
    ServerName www.theos.in
    ServerAlias theos.in
    ErrorLog "/var/log/theos.in-error_log"
    CustomLog "/var/log/theos.in-access_log" common
</VirtualHost>
 
<VirtualHost *:80>
    ServerAdmin webmaster@nixcraft.com
    DocumentRoot "/usr/local/docs/nixcraft.com"
    ServerName www.nixcraft.com
    ServerAlias nixcraft.com
    ErrorLog "/var/log/nixcraft.com-error_log"
    CustomLog "/var/log/nixcraft.com-access_log" common
</VirtualHost>


View more: http://www.cyberciti.biz/faq/warn-_defa ... recedence/

Những người đã like nghiatichxanh1992 bởi bài viết có ích này:
Merilo
Rating: 0.14%
 
nghiatichxanh1992 ✅
Hình đại diện của thành viên
Rank: ☀️2/30☀️
Cấp độ:
Tu luyện:
Like:
Online:
Bang hội: Tiếu Ngạo
Xếp hạng Bang hội: ⚡5/60⚡
Level:
Chủ đề đã tạo: 🩸4141/4141🩸
Tiền mặt:
Ngân hàng:
Nhóm:
Danh hiệu: ⚝Truyền Thuyết⚝
Giới tính:
Ngày tham gia:
Đến từ:
Thiết bị:
Số điện thoại:
(Cờ Rôm+ 33.0.175)


Quay về VPS - Server

 


  • Chủ đề tương tự
    Trả lời
    Xem
    Bài viết mới nhất


cron