gruszczy
gruszczy

Reputation: 42198

hgweb: repositories are displayed, but can't be accessed

I am trying to publish hg repository. I am using hg 1.7.3 and hgweb for multiple repositories. On the index page repository names are displayed, but when I click on them, I get information about broken link. Apache error log says:

[Tue Feb 01 15:41:31 2011] [error] [client 10.13.3.64] script not found or unable to stat: /home/hg/webdir/index.cgienigma-reports, referer: http://hg.internal/

I was trying to access path http://hg.internal/enigma-reports/. Any idea, what I might have done wrong?

My config in sites-available looks like this:

<VirtualHost *>
        ServerName hg.internal
        ScriptAlias / "/home/hg/webdir/index.cgi/"
</VirtualHost>

Before there was no trailing slash in the path to index.cgi. Why the trailing slash is required? Now it looks like a directory, rather than a file and seems very counter-intuitive.

Upvotes: 3

Views: 354

Answers (1)

Ry4an Brase
Ry4an Brase

Reputation: 78350

Your ScriptAlias line is probably wrong -- missing a trailing slash.

This is required because ScriptAlias does a substitution of the first part for the second part.

So when your URL comes in as:

http://hg.internal/enigma-reports/

and apache lops of protocol and host it becomes:

/enigma-reports/

and then ScriptAlias matches the first / and does the replacement, which before your update to add that slash yields

/home/hg/webdir/index.cgienigma-reports/

which isn't a valid script.

However with your new slash in place the substitution is:

/home/hg/webdir/index.cgi/enigma-reports/

Which turns engigma-reports/ in to the PATH_INFO CGI variable, which is what the script looks at.

Upvotes: 5

Related Questions