# Cgit with obhttpd (httpd port from OpenBSD)



## hephaestus (Apr 30, 2021)

Hi all!

I'm trying to add cgit to my current setup with obhttpd
This is my current configuariton of obhttp:


```
server "example.com" {
    listen on $ext_ip port 80

    # serve cgit static files: cgit.css, cgit.png
    location "/cgit.*" {
        root "/cgit"
        no fastcgi
    }
    # cgit CGI
    root "/cgit"
    fastcgi {
        socket "/var/run/fcgiwrap/fcgiwrap.sock"
        param CGIT_CONFIG "/usr/local/etc/cgitrc"
    }
}
```

My /usr/local/www is owned by www:www and this is cgit config:


```
footer=/usr/local/etc/cgit.footer

# Enable caching of up to 1000 output entries
#cache-size=1000

#cache-root=/cgit/cache

# Specify some default clone urls using macro expansion
clone-url=git://example.com/$CGIT_REPO_URL

# Specify the css url
css=/cgit.css

# Show owner on index page
enable-index-owner=0

# Allow http transport git clone
enable-http-clone=0

# Show extra links for each repository on the index page
enable-index-links=0

# Enable ASCII art commit history graph on the log pages
enable-commit-graph=1

# Show number of affected files per commit on the log pages
enable-log-filecount=1

# Show number of added/removed lines per commit on the log pages
enable-log-linecount=1

# Sort branches by date
branch-sort=age

# Add a cgit favicon
favicon=/favicon.ico

# Enable statistics per week, month and quarter
max-stats=quarter

# Set the title and heading of the repository index page
root-title=Heph repositories

# Set a subheading for the repository index page
root-desc=

# Allow download of tar.gz, tar.bz2 and zip-files
snapshots=tar.gz

## List of common mimetypes
mimetype.gif=image/gif
mimetype.html=text/html
mimetype.jpg=image/jpeg
mimetype.jpeg=image/jpeg
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml

## Search for these files in the root of the default branch of repositories
## for coming up with the about page:
readme=:README

virtual-root=/

scan-path=/usr/home/git/repos

# Disable adhoc downloads of this repo
repo.snapshots=0

# Disable line-counts for this repo
repo.enable-log-linecount=0

# Restrict the max statistics period for this repo
repo.max-stats=month
```

And also /usr/home/git/repos is owned by www

and dulcis in fundo /etc/rc.conf:


```
fcgiwrap_enable="YES"
fcgiwrap_user="www"
fcgiwrap_socket_owner="www"
fcgiwrap_socket_group="www"
fcgiwrap_socket="unix:/usr/local/www/var/run/fcgiwrap.sock"
```

If i try to connect to example.com i got 403 Forbidden, but if i try to example.com/cgit.css
i can see the content of the file..


----------

