7

I initially thought I had this problem:

https://stackoverflow.com/questions/28572629/a2ensite-site-does-not-exist-error-even-with-conf-file

But that did not help me.

I cd here:

  /etc/apache2/sites-enabled

I know the path to a2ensite:

  which a2ensite
  /usr/sbin/a2ensite

And I tested the configuration files with this:

  apachectl configtest

I get:

  Syntax OK

I have this file:

  ralph.stagingv2.example.conf

which starts with:

  ServerName ralph.stagingv2.example.com
  DocumentRoot "/home/ralph/example/current/web"
  DirectoryIndex index.php

I created the DocumentRoot with:

  mkdir -p /home/ralph/example/current/web

And I changed permissions to the user we use on AWS:

  chown -R ubuntu /home/ralph/
  chgrp -R www-data /home/ralph/

but when I do:

  a2ensite ralph.stagingv2.example

I get:

  ERROR: Site ralph.stagingv2.example does not exist!

What did I miss?

1
  • What is the path to your ralph.stagingv2.example.conf file and what operating system is Apache installed on?
    – Colt
    Commented Apr 19, 2016 at 15:28

1 Answer 1

9

a2ensite is a script that creates a sybolic link in /etc/apache2/sites-enabled pointing to a .conf file in /etc/apache2/sites-available.

In order to work, your .conf file must be in the "sites-available" directory, i.e.

 /etc/apache2/sites-available/ralph.stagingv2.example.conf

You should NOT actually "place" ANY configuration file in the /etc/apache2/sites-enabled directory.

6
  • 1
    That's a nice tip, but not really any issue I want to deal with right now. But hell, I'll give it a try.
    – lorm
    Commented Apr 19, 2016 at 16:28
  • 2
    Well, what exactly is it that you wanted help with then?
    – Colt
    Commented Apr 19, 2016 at 17:24
  • 4
    Note that the file HAS to end with .conf, otherwise it is not recognized.
    – Black
    Commented Sep 17, 2019 at 6:05
  • @Black this is the correct answer! Commented Dec 14, 2019 at 15:34
  • I don't have either of the sites-available or sites-enabled directories. Should I be concerned?
    – Matt
    Commented May 25, 2021 at 19:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .