Wednesday, May 21, 2014

Apache a2ensite with "Error! Site Does Not Exists"

Problem

I am now using "Apache/2.4.9 (Ubuntu)". After editing apache configuration file for my virtual hosted site (mysite.com), I found an error while trying to enable my site:
>> sudo a2ensite mysite.com

however, it returns:
"Error: mysite.com does not exists"

Solution

So, I start to trace the problem. a2ensite is simply a perl script, we can open it with a text editor, and I saw:


This means that only filenames with ".conf" at the end is allowed. Therefore, I have to rename my setting file for mysite.com:
mv /etc/apache2/sites-available/mysite.com /etc/apache2/sites-available/mysite.com.conf
This time, it works!

Discussion

I don't understand why the developer of this code brought out this design. Lots of people are used to name the configuration with their site domain name with ".conf". And, the developer should display more error message if ".conf" is required instead of only showing "does not exists" message.

Reference