Results 1 to 10 of 10

Thread: a2ensite - Error! Site does not exist

  1. #1
    Join Date
    Nov 2012
    Location
    Great Britain
    Beans
    80

    a2ensite - Error! Site does not exist

    when I run a2ensite with "a2ensite www.example.com"I get the error

    ERROR: Site www.example.com does not exist!
    I've added a file in the sites-enabled folder in /etc/apache2/sitesenabled
    I've added a site in /var/www/www.example.com/

    I've even tried running a2ensite in each of the folders...
    running a2ensite and pointing it to the file in the enabled-sites folder
    a2ensite /etc/apache2/sites-enabled/www.example.com
    gives the error:
    ERROR: No site found matching /etc/apache2/sites-enabled/www.example.com!

    This is my www.example.com file in sites-enabled:
    <VirtualHost *>
    ServerAdmin webmaster@example.com
    ServerName www.example.com
    ServerAlias example.com

    # Indexes + Directory Root.
    DirectoryIndex index.html
    DocumentRoot /var/www/www.example.com/
    </VirtualHost>
    Where have I gone wrong?

  2. #2
    Join Date
    Jun 2007
    Location
    Porirua, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: a2ensite - Error! Site does not exist

    I believe that /etc/apache2/sites-available is the default for containing the relevant configuration files, and then a2ensite creates the proper link/files in /etc/apache2/sites-enabled
    Forum DOs and DON'Ts
    Never assume that information you find using a search engine is up-to-date.

  3. #3
    Join Date
    Nov 2012
    Location
    Great Britain
    Beans
    80

    Re: a2ensite - Error! Site does not exist

    I just tried moving it over and running it again, but I get the same error

  4. #4
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,397
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: a2ensite - Error! Site does not exist

    What is the output of the following:

    Code:
    ls -l /etc/apache2/sites-available
    If you have a file called "www.example.com", then simply run:

    Code:
    sudo a2ensite www.example.com
    You should not need to point a2ensite at the entire directory tree, Apache2 will specifically look in /etc/apache2/sites-available.
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  5. #5
    Join Date
    Aug 2013
    Beans
    1

    Re: a2ensite - Error! Site does not exist

    I know this thread is a little bit older...

    but I had the same problem and came to this place. Renaming the file to example.conf did the job for me; so the .conf extension seemed to be necessary...

  6. #6
    Join Date
    Apr 2005
    Beans
    3

    Re: a2ensite - Error! Site does not exist

    Quote Originally Posted by dapleh View Post
    I know this thread is a little bit older...

    but I had the same problem and came to this place. Renaming the file to example.conf did the job for me; so the .conf extension seemed to be necessary...
    Never too old, thanks

  7. #7
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,837
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: a2ensite - Error! Site does not exist

    That's because the files in sites-enabled are included in the configuration by this directive in /etc/apache2/apache2.conf:

    Code:
    # Include the virtual host configurations:
    IncludeOptional sites-enabled/*.conf
    It only reads files matching *.conf.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  8. #8
    Join Date
    Nov 2013
    Beans
    1

    Re: a2ensite - Error! Site does not exist

    This seems to be quite a recent change in Ubuntu and caused me quite a bit of head-scratching. If you are on 12.10 then the virtual host file does not have to end in .conf but by 13.10 it does.

  9. #9
    Join Date
    May 2014
    Beans
    1

    Re: a2ensite - Error! Site does not exist

    I kinda feel compelled to make mention of this because I have been helped by this thread on more than one occasion.

    It's May 2014 and Ubuntu 14.04 has been out for a little while. Navigate to /etc/apache2/sites-available and see what's there. In the past the default website file has just been named "default" while later it was "default.conf" yet now it is "000-default.conf."

    "sudo a2dissite 000-default.conf" disables the default web site, allowing you to promote another one in its place.

    Hope this helps!

    Warren

  10. #10
    Join Date
    May 2008
    Beans
    19

    Re: a2ensite - Error! Site does not exist

    Quote Originally Posted by Warren_Parker View Post
    "sudo a2dissite 000-default.conf" disables the default web site, allowing you to promote another one in its place.
    Thank you for leaving this update, everyone left "000-" part out of the instructions (...ugh)
    I also needed to add the .conf extension to promote the other site that I replaced it with "sudo a2ensite exampleAltSite.conf"

    thanks for posting this

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •