Site does not exist error for a2ensite – Dev

The best answers to the question “Site does not exist error for a2ensite” in the category Dev.


I have under /etc/apache2/sites-available with the following code,

<VirtualHost *:80>
    ServerAdmin [email protected]

    DocumentRoot /var/www/

    LogLevel warn
    ErrorLog /var/www/
    CustomLog /var/www/ combined

Now when I use sudo /usr/sbin/a2ensite, I am getting the error,

ERROR: Site does not exist!

My webserver Apache/2.4.6 (Ubuntu)

How to solve this issue?


You probably updated your Ubuntu installation and one of the updates included the upgrade of Apache to version 2.4.x

In Apache 2.4.x the vhost configuration files, located in the /etc/apache2/sites-available directory, must have the .conf extension.

Using terminal (mv command), rename all your existing configuration files and add the .conf extension to all of them.

mv /etc/apache2/sites-available/ /etc/apache2/sites-available/

If you get a “Permission denied” error, then add “sudo ” in front of your terminal commands.

You do not need to make any other changes to the configuration files.

Enable the vhost(s):


And then reload Apache:

service apache2 reload

Your sites should be up and running now.

UPDATE: As mentioned here, a Linux distribution that you installed changed the configuration to Include *.conf only. Therefore it has nothing to do with Apache 2.2 or 2.4


Solved the issue by adding .conf extension to site configuration files.

Apache a2ensite results in:

Error! Site Does Not Exist

Problem; If you found the error while trying to enable a site using:

sudo a2ensite

but it returns:

Error: does not exist

a2ensite is simply a Perl script that only works with filenames ending .conf

Therefore, I have to rename my setting file for to as might be achieved as follows:

mv /etc/apache2/sites-available/ /etc/apache2/sites-available/



I just had the same problem. I’d say it has nothing to do with the apache.conf.

a2ensite must have changed – line 532 is the line that enforces the .conf suffix:

else {
    $sffx   = '.conf';
    $reload = 'reload';

If you change it to:

else {
    #$sffx   = '.conf';
    $sffx   = '';
    $reload = 'reload';

…it will work without any suffix.

Of course you wouldn’t want to change the a2ensite script, but changing the conf file’s suffix is the correct way.

It’s probably just a way of enforcing the “.conf”-suffix.


There’s another good way, just edit the file apache2.conf theres a line at the end

IncludeOptional sites-enabled/*.conf

just remove the .conf at the end, like this

IncludeOptional sites-enabled/*

and restart the server.

(I tried this only in the Ubuntu 13.10, when I updated it.)