aboutsummaryrefslogtreecommitdiff
path: root/infra/containers/cgit/nginx.conf
blob: df50345ee4487784b9fadb8aa60b7834470e8709 (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
# Copyright (C) 2026 Doan Luu Duc Tai <doan@luuduct.ai>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /dev/stderr warn;
events { worker_connections 1024; }
http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    access_log /dev/stdout;
    map $http_x_forwarded_proto $cgi_https {
        default "";
        https on;
    }
    server {
        listen 8080;
        server_name _;
        root /usr/share/cgit;
        location ~* ^/(cgit\.(css|png|js)|favicon\.ico|robots\.txt)$ {
            expires 30d;
        }
        location / {
            include /etc/nginx/fastcgi_params;
            fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
            fastcgi_param PATH_INFO $uri;
            fastcgi_param QUERY_STRING $args;
            fastcgi_param HTTP_HOST $http_host;
            fastcgi_param HTTPS $cgi_https;
            fastcgi_pass unix:/run/fcgiwrap/socket;
        }
    }
}