NameVirtualHost *:80 has no VirtualHosts – Apache

Write for Us: Familiar with Smart Home Automation, Media Streaming, HTPC, and Home Server topics? Write for us and get paid. Writing experience not required. APPLY HERE.

When upgrading from one version of Linux (Ubuntu in my case) to another or while transferring your websites to a clean install it is common to encounter the following warning while starting/restarting apache:

NameVirtualHost *:80 has no VirtualHosts

This happens when hosts are defined in both /etc/apache2/sites-available/default as well as /etc/apache2/ports.conf.

SOLUTION:

Comment out the the following lines in /etc/apache2/ports.conf:

#NameVirtualHost *:80
#Listen 80

Then restart your apache using the following command and you should not see the warning.

sudo /etc/init.d/apache restart

Thats it.

Did this post help you?
SmartHomeBeginner brings in-depth tutorials easy enough to understand even for beginners. This takes a considerable amount of work. If this post helps you, please consider supporting us as a token of appreciation:
  • Feeling generous? Become a Sponsor (discounted options) or a Patron. You will receive privileges on our Discord Server.
  • Just want to thank us? Buy us a Coffee or a Ko-Fi.
  • May be another day? Shop on Amazon using our links. Your prices won't change but we get a small commission.
  • Don't feel like spending? You can still show your support by sharing this post, linking to it in forums, or even commenting below.

Anand

Anand is a self-learned computer enthusiast, hopeless tinkerer (if it ain't broke, fix it), a part-time blogger, and a Scientist during the day. He has been blogging since 2010 on Linux, Ubuntu, Home/Media/File Servers, Smart Home Automation, and related HOW-TOs.