aboutsummaryrefslogtreecommitdiffstats
path: root/roles/jails/22_forge/templates/usr_local_etc_nginx_nginx.conf.j2
blob: d8c44ebe5c4576db8f577b750217488b2919fdcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
worker_processes 1;

events {
    worker_connections 1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile      on;
    keepalive_timeout 65;

    server {
        listen 80;
        server_name _;

        root /usr/local/www/cgit;

        # Block HTTP access to private (dot-prefixed) repos
        location ~ ^/\..+ {
            return 403;
        }

        # Anonymous git HTTP clone
        location ~ ^/(.+\.git)/(info/refs|git-upload-pack)$ {
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME /usr/local/libexec/git-core/git-http-backend;
            fastcgi_param GIT_HTTP_EXPORT_ALL 1;
            fastcgi_param GIT_PROJECT_ROOT /var/db/repos;
            fastcgi_param GIT_CONFIG_GLOBAL /usr/local/etc/git/gitconfig-www;
            fastcgi_param PATH_INFO $uri;
            fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock;
        }

        location / {
            try_files $uri @cgit;
        }

        location @cgit {
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME /usr/local/www/cgit/cgit.cgi;
            fastcgi_param PATH_INFO $uri;
            fastcgi_param QUERY_STRING $query_string;
            fastcgi_param GIT_CONFIG_GLOBAL /usr/local/etc/git/gitconfig-www;
            fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock;
        }
    }
}