6

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?

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

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.

| improve this answer | |
  • 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 Apr 19 '16 at 16:28
  • 2
    Well, what exactly is it that you wanted help with then? – Colt Apr 19 '16 at 17:24
  • 4
    Note that the file HAS to end with .conf, otherwise it is not recognized. – Black Sep 17 '19 at 6:05
  • @Black this is the correct answer! – Ramin Firooz Dec 14 '19 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.