Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an ubuntu hardy server used as a web server with Apache 2.2. I am trying to set it up with named virtual hosts, and in my /etc/apache2/apache2.conf file I have the following lines:

NameVirtualHost *
Include /etc/apache2/sites-enabled/

I have two files in sites-enabled. One of them containing:

<VirtualHost *>
        ServerAdmin webmaster@met.no
        ServerName arcticdata.met.no
        DocumentRoot /metno/metamod/arcticdata/htdocs
...
</VirtualHost>

The other is similar, but with another ServerName and DocumentRoot.

If I run apachectl configtest I get the following warning:

[warn] NameVirtualHost *:0 has no VirtualHosts

But anyway it seems the virtual host mechanism is working, since I get to an index.html file placed in DocumentRoot in both cases.

But I also use redirect to a catalyst process on the same server, and these redirects does not seem to work:

ProxyPass           /metamod/         http://127.0.0.1:3011/
ProxyPassReverse    /metamod/         http://127.0.0.1:3011/

Hovever, If I enter the IP address and port number in the -directive (in place of *), these redirects suddenly works. But then I have another problem. Now running apachectl configtest gives the following output:

[warn] VirtualHost 157.249.32.169:80 overlaps with VirtualHost 157.249.32.169:80, the first has precedence, perhaps you need a NameVirtualHost directive
[warn] NameVirtualHost *:0 has no VirtualHosts

and only the first virtual host work.

I am also running a similar setup on a lucid box, and this works OK. Are there changes in how Apache 2.2 is configured between hardy and lucid? The hardy box has Apache 2.2.8 and the lucid box has Apache 2.2.14.

Any suggestions appreciated.

Egil

share|improve this question
    
Not contributing to any solution: are you aware that hardy is very near to its End Of Life? –  guntbert Mar 5 '13 at 17:37
    
I know, and the box will soon be upgraded. But I need it to work now. –  Egil Støren Mar 6 '13 at 8:15
add comment

2 Answers 2

up vote 0 down vote accepted

I would recommend that you use the address:port notation as specified in the apache manual:

http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost

Probably something has changed in the apache code, since it looks like it defaults to port 0 in hardy, but your websites default to port 80.

E.g. change it to:

NameVirtualHost *:80

and

<VirtualHost *:80>

If that doesn't work then use:

NameVirtualHost 157.249.32.169:80

and

<VirtualHost 157.249.32.169:80>
share|improve this answer
    
Thanks a lot. Your second suggestion worked. –  Egil Støren Mar 6 '13 at 8:14
    
@EgilStøren please "accept" this answer if it solved your problem. –  guntbert Mar 6 '13 at 14:51
add comment

Correct your apache configuration so that the aprobiate ports are clear.

 NameVirtualHost *:80
 NameVirtualHost *:443

and

<VirtualHost *:80>
</VirtalHost>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.