13

I'm trying to automate some new site deployment in my testing environment. My script auto generates the apache vhost file in

/etc/apache2/sites-available/testsite.com

then a2ensite is run via the same script

a2ensite /etc/apache2/sites-available/testsite.com

I get:

ERROR: No site found matching /etc/apache2/sites-available/testsite.com!

The script is being run as root.

I read that you must a2ensite from the sites-available directory but if this is being done via script how would I tell a2ensite to think its in the proper directory?

Thanks,

user564448
  • 387
  • 3
  • 9

1 Answers1

23

a2ensite's man page doesn't mention it explicitly, but you actually should supply just a name of the site to be enabled, like...

a2ensite testsite.com

... and not the whole path to it.

raina77ow
  • 103,633
  • 15
  • 192
  • 229
  • This is not working for me same problem. Everything seems fine same error. – Leap Hawk Jun 19 '17 at 18:30
  • `a2ensite testsite.com.conf` <-- actually it's a **file name** that is required. This could be the same as the site name, but I usually see a `.conf` extension on it. This file resides in the sites-available directory. You're right, the a2ensite man-page drops the ball on this. – Bob Stein Dec 02 '22 at 22:31