I installed Apache 2.4 on Ubuntu 14.04 and it was working fine by http://localhost/ address. But when I tried to add a new virtual host, for example http://bow.loc and restart apache, new address was not available on http://bow.loc and available on http://localhost.

My configuration is:

<VirtualHost *:80>
    ServerName www.bow.loc
    ServerAlias bow.loc
    DocumentRoot /var/www/html/bow/web

    <Directory /var/www/html/bow>
        AllowOverride All
        Options FollowSymLinks MultiViews
        Order allow,deny
        Allow from all
        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ /app.php [QSA,L]

    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined

How can I get my site by http://bow.loc?

  • Related: askubuntu.com/a/362992/8698 – Dan Apr 21 '14 at 8:34
  • Check out my answer here. Got similar problem and it turns out to be the problem with system DNS configuration. – jmarceli Apr 23 '15 at 21:29

Since Apache 2.4, each virtual host file should have the .conf extension.

You can rename each virtual host file to include the .conf extension:

mv /etc/apache2/sites-available/example.com /etc/apache2/sites-available/example.com.conf

Use the a2ensite command to add the virtual host:

a2ensite example.com.conf

And reload Apache:

service apache2 reload
  • Thanks! And after this actions I don't need manually modified the /etc/hosts file and add hosts to it? Does apache will write new hosts automatically? – Victor Bocharsky Apr 23 '14 at 13:03
  • Apache doesn't write new hosts automatically, you should write it manually. CMIIW – Ari Pratomo Apr 25 '14 at 8:53
  • So, my config is right, and problem in order that I forgot to add host in /etc/hosts – Victor Bocharsky Apr 28 '14 at 6:45
  • other way is to modify apache2.conf and remove the ".conf" extension from the "IncludeOptional sites-enabled/*" directive. I use website domains as file names, so I dislike the extra ".conf" requirement. – lepe Aug 16 '14 at 3:54

I forgot to add host in /etc/hosts:   localhost   bow.loc

I thought apache does it automatically.

  • I've not had to do that any time before on a server. I do it from the client for testing purposes all the time though. Can you clarify what you are saying here? – flickerfly May 28 '15 at 17:36
  • @flickerfly What are you meant? I made my virtualhosts points to my local machine to handle them with installed Apache server – Victor Bocharsky May 30 '15 at 21:46
  • I forgot to add this as well! :P – Rishi Kulshreshtha Dec 26 '15 at 14:02
  • Damn, I wasted one our on this on a Debian 8 VM! Thanks!!! – lucaferrario Jan 10 '17 at 16:54
  • @lucaferrario haha, me either. Simple bugs difficult to reveal ;) You're welcome! – Victor Bocharsky Jan 12 '17 at 8:20

Well, I have been trying all these solutions offered..but sadly nothing worked! Alas i edited


to make entry example.com test.com

and it worked!!

(Sorry if I'm not talking much technically!)


I wrote a python script that will automate the apache virtual host creation steps ... this video explains how, download/code on GitHub

Options FollowSymLinks MultiViews

Need char '+' : +FollowSymLinks +Multiviews

Order allow,deny
Allow from all

Now = Require all granted

  • Please explain, where to put this and what it does. Don't just post commands or configuration artefacts. See How do I write a good answer? – David Foerster Apr 7 '15 at 10:55
  • 1
    You only need to put a + or - before the various Options if you are using a - to exclude one. Otherwise, they are good to go. Required all granted is for Apache 2.4. The Order, Allow lines are a 2.2 syntax. – flickerfly May 28 '15 at 17:33

protected by Community May 30 '16 at 11:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.