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,507
  • 10
  • 57
  • 85
alex
  • 361
  • 1
  • 3
  • 3

1 Answers1

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
  • 230
  • 1
  • 10
quadruplebucky
  • 5,139
  • 20
  • 23
  • 36
    I ran into the same error message after an upgrade, but simply removing the `NameVirtualHost` directive was not enough to get Apache working again for me. Every request got processed by the default vhost, regardless of IP and host header. Turns out something else had changed during the upgrade as well. The old `apache2.conf` permitted vhosts whose name did not end with `.conf`, the new configs silently ignored all such vhosts. Wanted to leave this comment here, such that the next person to run into that hopefully won't have to spend as much time on it, as I did. – kasperd Aug 09 '14 at 10:53
  • 6
    be sure to change you conf(s) after removing NameVirtualHost so you have: – OnePablo Oct 01 '14 at 14:11
  • 1
    As a followup to kasperd's comment, .conf files in sites-available need the .conf extension. I came across this thread while upgrading from Apache 2.2 to 2.4. https://linode.com/docs/security/upgrading/updating-virtual-host-settings-from-apache-2-2-to-apache-2-4/ – wruckie Mar 10 '16 at 12:50