0

I have a gitolite development server and I'm trying to automate creation of new virtualhosts.

I figured rather than try to have the gitolite user (non root) create new config files in /etc/apache2/sites-available I would symlink a /home/gitolite/sites-available directory to it.

I can run this:

sudo ln -s /home/gitolite/sites-available/* /etc/apache2/sites-available/

and then I can see the sites in the symlinked directory

 default  symlinkedsite.com  nonsymlnkedsite.com

But it would seem to me that I would need to re-run that command if I created a new file, so it doesn't accomplish what I need.

I originally was trying this

sudo ln -s /home/gitolite/sites-available /etc/apache2/sites-available/

which creates a symlinked sites-available directory in /etc/sites-available

But if I run a2ensite it can't follow that symlink.

I know that in order for an apache2 virtualhost to use symlinks, followsymlinks must be enabled. Is there a similar option for the apache2 sites-available config directory?

I scanned apache2.conf but I didn't see something obvious.

2 Answers 2

1

You should add an include line to your main httpd.conf (or apache2.conf)

You probably have something similar to this in your config already:

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
Include /etc/apache2/conf.d/

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

what you want to add is:

# Include gitolite files
Include /home/gitolite/sites-available/

This will tell httpd to include .conf files in that directory of course you would have to give the apache user read perms to that folder as well.

2
  • Okay, added Include /home/gitolite/sites-available/ to apache2.conf - The directory and files are 744, but a2ensite can't see them. Am I doing something wrong?
    – Brian
    Aug 4, 2011 at 1:52
  • @brian you don't need to use a2ensite, the changes should be picked up on a reload of apache. all a2ensite does is symlink from sites-available to sites-enabled.
    – Zypher
    Aug 4, 2011 at 2:05
0

Well I brute-forced it somewhat by entirely replacing the original sites-available directory with a symlink to the one I needed.

@Zypher - I think I need a2ensite, no? To create a symlink manually to sites-enabled I'd need to give gitolite some kind of privileges, I just added /usr/sbin/a2ensite in visudo instead

You must log in to answer this question.

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