Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can map /hg on the server to hgweb.cgi using:

ScriptAlias /hg "/home/user/webdir/hgweb.cgi"

but how do I map / (the server root) to the CGI script?

UPDATE: Here is what worked for me:

  1. Disable the default site using sudo a2dissite default
  2. Create /etc/apache2/sites-available/hg with the following contents:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerAlias code
        DocumentRoot /srv/hg/cgi-bin/

        <Directory "/srv/hg/cgi-bin/">
                AddHandler cgi-script .cgi
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                AllowOverride None
                Order allow,deny
                Allow from all
                DirectoryIndex hgweb.cgi
share|improve this question
up vote 1 down vote accepted
  1. Add AddHandler: AddHandler cgi-script .cgi
  2. Add +ExecCGI: Options +ExecCGI
  3. Change DirectoryIndex: DirectoryIndex hgweb.cgi
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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