2

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 [email protected]
        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

2
  • Not contributing to any solution: are you aware that hardy is very near to its End Of Life?
    – guntbert
    Mar 5, 2013 at 17:37
  • I know, and the box will soon be upgraded. But I need it to work now. Mar 6, 2013 at 8:15

2 Answers 2

0

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>
0
0

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

 NameVirtualHost *:80
 NameVirtualHost *:443

and

<VirtualHost *:80>
</VirtalHost>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .