36

What do you think would be solution to my problem?

user@admin:~$ sudo service apache2 restart
sudo: unable to resolve host admin
* Restarting web server apache2                                                
AH00548: NameVirtualHost has no effect and will be removed in the next release
/etc/apache2/ports.conf:8
BenMorel
  • 4,685
alex
  • 361

2 Answers2

50

From the Apache 2.4 documentation:

Prior to 2.3.11, NameVirtualHost was required to instruct the server that a particular IP address and port combination was usable as a name-based virtual host. In 2.3.11 and later, any time an IP address and port combination is used in multiple virtual hosts, name-based virtual hosting is automatically enabled for that address.

This directive currently has no effect.

The solution to your problem is to remove the NameVirtualHost directive.

redseven
  • 282
quadruplebucky
  • 5,314
  • 24
  • 24
0

So 10 years later, it still complains about this, but it's essential in order to have virtual hosts working with a shared IP. I'd have no problem assigning a free ipv6 address to each virtual host, but that's just not going to work until ipv6 is ubiquitous, and I really don't want to be buying up a bazillion IPv4 addresses.

bar@foo:~$ cat /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module> Listen 443 NameVirtualHost *:443 SSLStrictSNIVHostCheck off </IfModule>

<IfModule mod_gnutls.c> Listen 443 </IfModule>