Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 3195  / 1 Year ago, sun, april 23, 2023, 4:47:28

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


More From » apache2

 Answers
3

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>

[#32353] Monday, April 24, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ravturtl

Total Points: 335
Total Questions: 132
Total Answers: 110

Location: Tanzania
Member since Wed, Feb 24, 2021
3 Years ago
;