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

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

1 Answer 1

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.