Solved

VirtualHosts message when stopping/starting apache

Posted on 2012-04-09
13
661 Views
Last Modified: 2012-05-17
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.
0
Comment
Question by:U_S_A
  • 6
  • 5
  • 2
13 Comments
 
LVL 28

Expert Comment

by:Jan Springer
ID: 37824278
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".
0
 

Author Comment

by:U_S_A
ID: 37824536
Where would I make these changes, please?
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 37824588
In your httpd.conf file either found in /etc/httpd/conf or /usr/local/apache2/conf
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Author Comment

by:U_S_A
ID: 37824943
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.
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 37825254
How are you making the changes today?  The configuration file suggests that it is not done by directly writing to the httpd.conf?
0
 

Author Comment

by:U_S_A
ID: 37825266
I've not made any changes today... but I suppose that WHM is writing to that file.
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 37825339
What is 'WHM'?
0
 

Author Comment

by:U_S_A
ID: 37825527
0
 

Author Comment

by:U_S_A
ID: 37828346
I'm still lost.
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 37828538
I am sorry.  I am unfamiliar with cpanel and whm.
0
 
LVL 4

Expert Comment

by:senseifedon
ID: 37838308
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.
0
 

Author Comment

by:U_S_A
ID: 37889198
I checked my settings - they already look this way.
0
 
LVL 4

Accepted Solution

by:
senseifedon earned 500 total points
ID: 37893775
Your settings is in the below lines:
NameVirtualHost xxx.xxx.xx.13:80
<VirtualHost xxx.xxx.xx.13:80>

Open in new window


But the lines should have been like these:
NameVirtualHost *:80 
<VirtualHost *:80>

Open in new window


Carefully look the lines. You should use * instead of xxx.xxx.xx.13 (ip address).
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question