Link to home
Start Free TrialLog in
Avatar of U_S_A
U_S_A

asked on

VirtualHosts message when stopping/starting apache

I recently changed the IP addresses for 4 of my domains on my server to 4 new IPs that I had which were not being used.  Everything seems to be working properly, but I noticed the messages below when I stop & start httpd service.

I did not have those messages previously.  I think I made a mistake or forgot to do one additional step.

I'm using WHM/cpanel - centos

root@cv2 [/etc]# service httpd stop
[Sun Apr 08 11:50:01 2012] [warn] NameVirtualHost xxx.xxx.xx.12:80 has no VirtualHosts
[Sun Apr 08 11:50:01 2012] [warn] NameVirtualHost xxx.xxx.xx.13:80 has no VirtualHosts
[Sun Apr 08 11:50:01 2012] [warn] NameVirtualHost xxx.xxx.xx.10:80 has no VirtualHosts
[Sun Apr 08 11:50:01 2012] [warn] NameVirtualHost xxx.xxx.xx.10:80 has no VirtualHosts
[Sun Apr 08 11:50:01 2012] [warn] NameVirtualHost xxx.xxx.xx.10:80 has no VirtualHosts
[Sun Apr 08 11:50:01 2012] [warn] NameVirtualHost xxx.xxx.xx.10:80 has no VirtualHosts
[Sun Apr 08 11:50:01 2012] [warn] NameVirtualHost xxx.xxx.xx.11:80 has no VirtualHosts

Also I see .10 is listed 4 times.  That also makes me think something additional is wrong.  The other domains are listed only once.

I have 4 domains:
domain1 xxx.xxx.xx.10
domain2 xxx.xxx.xx.11
domain3 xxx.xxx.xx.12
domain4 xxx.xxx.xx.13

Could someone give me some advice or direction about this?  

Thank you.
Avatar of Jan Bacher
Jan Bacher
Flag of United States of America image

Change all of you NameVirtualHost  statements to be just (no quotes) "NameVirtualHost *:80" and make sure that you have "Listen a.b.c.d:80" for each IP address -- or you can just do a "Listen 80".
Avatar of U_S_A
U_S_A

ASKER

Where would I make these changes, please?
In your httpd.conf file either found in /etc/httpd/conf or /usr/local/apache2/conf
Avatar of U_S_A

ASKER

Here is one entry I have in that file (I have the same type of info for each IP adress)

NameVirtualHost xxx.xxx.xx.13:80
<VirtualHost xxx.xxx.xx.13:80>
    ServerName domainname.com
    ServerAlias www.domainname.com
    DocumentRoot /home/username/public_html
    ServerAdmin webmaster@domainname.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/domainname.com combined
    CustomLog /usr/local/apache/domlogs/domainname.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User username # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup username username
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup username username
    </IfModule>
    ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/


    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/username/domainname.com/*.conf"

</VirtualHost>
----------
with this new info, do I need to make any changes as you suggested?


I also found this in the file

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.
NameVirtualHost xxx.xxx.xx.186:80
NameVirtualHost xxx.xxx.xx.14:80
NameVirtualHost xxxx.xxx.xx.9:80
NameVirtualHost *
# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.
-----------

the .14 and .9 are old addresses

What do you recommend, please.  I've not yet made any changes yet.

Thank you.
How are you making the changes today?  The configuration file suggests that it is not done by directly writing to the httpd.conf?
Avatar of U_S_A

ASKER

I've not made any changes today... but I suppose that WHM is writing to that file.
What is 'WHM'?
Avatar of U_S_A

ASKER

I'm still lost.
I am sorry.  I am unfamiliar with cpanel and whm.
Hi;
One week ago I had same problem. The solution was inside of the httpd.conf. First of all open httpd.conf file. Then follow this directives:

1. NameVirtualHost *:80
    NameVirtualHost *:443

2.
<VirtualHost *:80>
    ServerName domain1.xxxx
    ServerAlias www.domain1.xxxx
    DocumentRoot /var/www/html/domain1/
    ServerAdmin root@domain1.xxx
    UseCanonicalName On
    ErrorLog logs/domain1-error_log
    CustomLog logs/domain1-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerName domain2.xxxx
    ServerAlias www.domain2.xxxx
    DocumentRoot /var/www/html/domain2/
    ServerAdmin root@domain2.xxx
    UseCanonicalName On
    ErrorLog logs/domain2-error_log
    CustomLog logs/domain2-access_log common
</VirtualHost>
.
.
.
apply same config for domain3.xxx and domain4.xxxx

Most important thing NameVirtualHost and <VirtualHost *:80>.

Then restart apache. You will see there is no error.
Avatar of U_S_A

ASKER

I checked my settings - they already look this way.
ASKER CERTIFIED SOLUTION
Avatar of senseifedon
senseifedon
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial