Question

Apache is configured like so:

Alias /git /var/www/gitweb
Alias /gitweb /var/www/gitweb

<Directory "/var/www/gitweb">
  AllowOverride None
  Options +ExecCGI +Indexes
  Order allow,deny
  Allow from all

  DirectoryIndex gitweb.cgi
  AddHandler cgi-script .cgi

  SetEnv GITWEB_CONFIG /var/www/gitweb/gitweb.conf
</Directory>

I am trying to setup Gitweb, but I keep getting the dreaded 404 - No projects found issue. Usually this is a permissions error so I wanted to see if anything was printed by perl not having permissions so I ran it from the terminal with this command

sudo -u apache GITWEB_CONFIG=/var/www/gitweb/gitweb.conf perl gitweb.cgi

The script echoed the HTML with all of the repositories properly listed (i.e., no 404).

Here is the question: why would the same script run from Apache and the terminal behave differently?

Was it helpful?

Solution

The issue was SELinux. My repositories are in the directory /home/git. The httpd service was not able to access that directory by default.

Ran setsebool -P httpd_enable_homedirs=1 and the issue was resolved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top