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?

lorm
  • 173
  • 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

1 Answers1

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.

Colt
  • 2,067
  • 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 06:05
  • @Black this is the correct answer! – Ramin Firooz Dec 14 '19 at 15:34
  • I don't have either of the sites-available or sites-enabled directories. Should I be concerned? – Matt May 25 '21 at 19:07
  • @Matt yes. You should ask a separate question, though, where you can provide details of your setup and get help either finding the directories, or repairing if possible the deployment. Welcome to Server Fault. Be sure to read up on how to write good questions here, and what is acceptable in the forum, so you have the best chance of getting a good result. – Colt May 26 '21 at 03:38