Site does not exist error for a2ensite

devo picture devo · Dec 15, 2013 · Viewed 286.7k times · Source

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

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName www.cmsplus.dev
    ServerAlias cmsplus.dev

    DocumentRoot /var/www/cmsplus.dev/public

    LogLevel warn
    ErrorLog /var/www/cmsplus.dev/log/error.log
    CustomLog /var/www/cmsplus.dev/log/access.log combined
</VirtualHost>

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

ERROR: Site cmsplus.dev does not exist!

My webserver Apache/2.4.6 (Ubuntu)

How to solve this issue?

Answer

devo picture devo · Dec 15, 2013

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 example.com

but it returns:

Error: example.com 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 example.com to example.com.conf as might be achieved as follows:

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

Success