LinuxMoz

Linux Stuff && Coffee

[Warn] _default_ VirtualHost Overlap on Port 80, the First Has Precedence Apache

| Comments

When restarting Apache (or httpd service) if you get the following Apache error: [warn] default VirtualHost overlap on port 80, the first has precedence on Linux (CentOS, Ubuntu, Fedora, etc) chances are you are configuring vhosts or adding additional virtual hosts to your Apache config.

You are probably seeing an error similar to the following:

1
2
3
[root@server ads]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: [Fri Mar 23 07:55:04 2012] [warn] VirtualHost 192.168.1.2:80 overlaps with VirtualHost 192.168.1.2:80, the first has precedence, perhaps you need a NameVirtualHost directive

Fix Apache Error: [warn] default VirtualHost overlap on port 80, the first has precedence

[warn] _default_ VirtualHost overlap on port 80, the first has precedence Apache To fix the Apache error message [warn] default VirtualHost overlap on port 80, the first has precedence Apache you need to open the file httpd.conf file in Vi and add the following line:

1
vi /etc/httpd/conf/httpd.conf

Add the following:

1
NameVirtualHost *:80

You then need to configure your vhosts as follows:

1
2
3
4
5
6
7
8
9
  ServerName linuxmoz.com
  ServerAlias *.linuxmoz.com
  ServerAdmin [email protected]
  ErrorLog /var/log/httpd/linuxmoz.com-example.err
  CustomLog /var/log/httpd/linuxmoz.com.log combined
  DocumentRoot /var/www/linuxmoz

    Order allow,deny
    Allow from all

*note the :80 – this means it will run on any IP address configure on your server.

If you need to run the vhost on a specific IP address use the following:

1
NameVirtualHost 192.168.1.2:80

Obvious replace the IP with your servers IP address, you also need to reconfigure your vhost files to use the IP address.

If you restart Apache / Httpd you should now see:

1
2
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

Your formatting may differ the above was taken from a CentOS Apache restart, your may fine this Centos install Apache guide useful.

The Apache error message [warn] default VirtualHost overlap on port 80, the first has precedence should now be sucsessfully fixed.

Comments