[Apache] Create directory to domain - the domain Dns folder vps

Thứ Hai, 26 tháng 5, 2014
Apache: [warn] _default_ VirtualHost overlap on port 80, the first has precedence Error and Solution 

Question: I'm using Apache 2 to host multiple sites on a single host using Apache name based VirtualHost feature .  Tuy nhiên, Apache Displaying lots of warning is as follows: 

Code:
  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: 14 968.
 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 the httpd.conf file: 
Code:
  # Vi / etc / httpd / conf / httpd.conf 
Add NameVirtualHost as follows: 
Code:
  NameVirtualHost *: 80 
OR add server IP: 
Code:
  NameVirtualHost 202.54.1.1:80 
Save and close the file. restart httpd web server under RHEL / Red Hat / Fedora / CentOS Linux : 
Code:
  # Service httpd restart 
OR type the theo to restart Apache 2 under Debian / Ubuntu Linux : 

Sample Apache 2 Virtual hosting configuration: 

Muốn Maintain multiple domains / hostnames on máy you can setup VirtualHost containers for them. Most configurations use only name-based virtual hosts than the server does not need to worry about IP addresses. This is ngụ ý by the asterisks in the directives below. 

Code:
  # 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> 
Chia sẻ bài viết ^^
Other post

All comments [ 0 ]


Your comments