# Apache2 latest update virtual hosts issue - Apache2 DOWN

## torbens

Hi All,

I've just updated to the latest apache2 and this is to register a complaint - the newest update has completely revised the configuration files and forced me to make several changes - is there no way to inform people of this before they perform an update????  Right now my webserver is DOWN as I didn't put my vhosts.conf file in the right place.

I have to say this update is the most ill-considered of any updates - people in production environments don't like being forced to move their configuration files around at the whim of developers.

As well, having to move the virtual hosts config files to "'/usr/lib/apache2/conf/vhosts.d"  is not exactly something I'm up for, since this seems like a fairly random place to put them - what is the reasoning behind this place?  why not /etc/apache2/conf/vhosts like before?

And it's not like I can rewrite the vhosts config file path as in the NEW httpd.conf file it's listed as 

Include conf/vhosts.d/vhosts.conf

which means it must be in /usr/lib for the apache2 permissions chain to work out ..

Is there a document describing how to make this upgrade????  If not, why not???? as the changes from apache2.conf to httpd.conf are HUGE!

After trying to get this to work, now its complaining about my old vhosts.conf file, which used to work no problems ... anybody have any suggestions?

gentoo_server# /etc/init.d/apache2 restart

 * Restarting apache2...

[Wed Jul 13 08:58:02 2005] [warn] NameVirtualHost *:80 has no VirtualHosts   

my vhosts.conf file:

<VirtualHost *:80>

    ServerName xxxxx.com

    Serveralias www.xxxxx.com

    DocumentRoot /var/www/xxxxx.com/html

    DirectoryIndex index.php index.html

    ErrorLog /var/www/xxxxx.com/logs/error.log

    CustomLog /var/www/xxxxx.com/logs/access.log combined

</VirtualHost>

----------

## torbens

so no-one has a link to ionfo about this update - has anyone else encountered problems (incl virtual hosts) updating apache2 to the most recent version?

----------

## rockcat

In /etc/conf.d/apache2 you can tell it where to look for the config file - you *should* be able to put /etc/apache2/conf/apache2.conf

I agree the update was poorly done - I updated mod_php, which updated apache, so I didn't see any messages about relocating files. On the php 5.1 beta ebuild, there is a message about it being masked until stable (something like that). That would have been a better place to put notifications, since I would have seen it.

I have been having issues with apache (but I had to unmask it - amd64 machine). I think they are related to the config file changes I made. I've been working on it since yesterday - but this is my development machine, so I have a little less pressure.

Btw, on my machine /usr/lib/apache2/conf is a link to /etc/apache2

Hope you get this resolved - Gentoo's instability is the reason my server runs Slackware  :Laughing: 

----------

## PChaos

Same Problem with vhosts here.

Some of new places to put configuration files or log-files are really ill-considered.

Why placing general log files somewhere in /usr/lib, fo me it seems to make more sense to keep them in /var/log

and concerning the conf files, well, i can only see this as a mistake, as emerging apache2 still creates some stuff in /etc/apache2/conf.

But anyway vhosts are still a no go

----------

## torbens

hey guys - thanks for responses its appreciated 

I do have the server back up - and working - but apache still claims my vhosts file is wrong even as it works - hmmmm apache used to crap out if the vhosts file was wrong wonder what's up?

----------

## lorenb

 *torbens wrote:*   

> Hi All,
> 
> I've just updated to the latest apache2 and this is to register a complaint - the newest update has completely revised the configuration files and forced me to make several changes - is there no way to inform people of this before they perform an update????  Right now my webserver is DOWN as I didn't put my vhosts.conf file in the right place.
> 
> 

 

I got burned like that a few months ago but I run ~amd64 so I was kind of asking for it and can't complain.  You can always see the ChangeLog before you do an upgrade just pass emerge the --changelog or -l switch and it will show you.  

 *Quote:*   

> Is there a document describing how to make this upgrade????  If not, why not???? as the changes from apache2.conf to httpd.conf are HUGE!

 

There are two documents offhand I know of that try and describe the changes and why they were made:

http://www.gentoo.org/proj/en/apache/upgrading.xml

http://gentoo-wiki.com/HOWTO_Apache2

 *Quote:*   

> 
> 
> After trying to get this to work, now its complaining about my old vhosts.conf file, which used to work no problems ... anybody have any suggestions?
> 
> gentoo_server# /etc/init.d/apache2 restart
> ...

 

After I did the upgrade and fixed everything I got the same warning when I start apache.  I've not been able to figure out how to get rid of it but it's not affecting the operation of the server.  It's just an annoyance at this point.

----------

## morphal

Holy smokes! I fixed this problem on my server earlier!

From what I can tell, apache just doesn't like the *:80 anymore. It's apparently looking for literal matches to the addresses you've got listed for your vhosts and the wildcard doesn't count. I replaced the * with an IP address and it quit complaining. If you've got just tons and tons of IP addresses, that might be a pain but it's a fix ... whether or not it's the fix for you ...

----------

## PChaos

1. New update available with slightly fixed includes to config files

2. got mine running after changing path/location of config files

3. Try a plain "NameVirtualHosts 80" at least for me it works after i had some errors about this before

----------

## c0r3dump

 *Quote:*   

> [Wed Jul 13 08:58:02 2005] [warn] NameVirtualHost *:80 has no VirtualHosts 

 

I figured it out.

in folder /etc/apache2/vhost.d you should have a file in there like 00_default_vhost.conf

edit that file and comment the line like so ( add a # in front of NameVirutalHost)

#NameVirtualHost *:80

for some reason they forgot to add the #

should be about line 18

### Section 3: Virtual Hosts

#

# VirtualHost: 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.

#

# Please see the documentation at 

# <URL:http://httpd.apache.org/docs-2.0/vhosts/>

# for further details before you try to setup virtual hosts.

#

# You may use the command line option '-S' to verify your virtual host

# configuration.

#

# Use name-based virtual hosting.

#

#NameVirtualHost *:80 <----------------THIS IS THE LINE

#

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

# server name.

#

#<VirtualHost *:80>

#    ServerAdmin webmaster@dummy-host.example.com

#    DocumentRoot /www/docs/dummy-host.example.com

#    ServerName dummy-host.example.com

#    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log

#    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common

#</VirtualHost>

----------

## morphal

For what it's worth, the problem is that if you have a line declaring a virtual host that's responding on all available IP addresses using port 80 (which is what *:80 means) then you have to actually set up a directive for that virtual host. Essentially you're telling Apache to respond on *:80 but not telling it anything about what you want it to respond with.

My previous fix was indeed a fix, I just didn't know exactly why at the time.

----------

## c0r3dump

Ok. you're info fixed the problem.

I got the same error apon upgrading apache and didnt know why: 

* Restarting apache2...

[Wed Jul 13 08:58:02 2005] [warn] NameVirtualHost *:80 has no VirtualHosts

Just stating to other people that may find this post to comment out that one line if they do not use a vhost will fix the problem.

Not trying to correct your statement, just adding to it.

*peace*  :Cool: 

----------

## morphal

Yes, commenting it out works just fine. I was attempting to explain why commenting fixed the problem but I somehow managed to never actually say it.:roll: I'm so easily put off-subject.

I think what they were aiming for was a bit more of a fallback system though. By having both a default host and a specifically defined host, you have a more control over who gets what page when they enter a given address. It's also easy to just add one more vhost definition to serve yet another address. Admittedly, most of the average users who end up confused by this error will never use this functionality but that's the idea they had in mind.

When it comes right down to it, you can delete the vhosts file altogether and just make a normal httpd.conf.

Speaking of default hosts though, it may be a good idea to check the /etc/conf.d/apache2 file and see if you're defining the option for a default vhost. It's enabled by default. Look in the line that says 

```
APACHE2_OPTS=
```

There will probably be at least a couple things typed in the quotes after the equal sign.

If you want to use a default vhost, leave it alone. If you want it gone, delete the whole 

```
-D DEFAULT_VHOST
```

You can find out whether or not you're currently using the default vhost by looking through your .conf files for apache (wherever they are for you, generally httpd.conf and any .conf files in your vhosts.d directory) and looking for the 

```
<IfDefine DEFAULT_VHOST>
```

 line and seeing if you've set up anything in that statement.

----------

