0

我在 Cgit 上显示我的 git 存储库,一切正常,除了 CSS 不会在网站上加载。奇怪的是,当我查看页面源代码并单击 CSS 文件的链接时,它会加载文本。

我点击这个: 页面来源

我得到了这个: CSS文件

但我的 Cgit 网站是纯 html。

这是我的配置。(我将我的网站名称添加到 example.com)

nginx.conf:

worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 1024;
}

http {
        server { 
                root /srv/www;
                listen 80;
                listen 443 ssl;
                server_name example.com www.example.com;
                ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
                ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
        }
        server {
                server_name           git.example.com;
                listen 80;
                listen 443 ssl;
                root                  /usr/share/cgit;
                try_files             $uri @cgit;
                ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
                ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot

                location @cgit {
                        include             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       $server_name;
                        fastcgi_pass        unix:/run/fcgiwrap.socket;
                }
        }
        add_header expires off;

        gzip on;
}

/etc/cgitrc:

#
# cgit config
# see cgitrc(5) for details

virtual-root=/

css=/cgit.css
logo=/snowman.png

scan-path=/srv/git/

问我是否需要查看任何额外的文件 :^)。

4

0 回答 0