详细配置可参考:如何在 Debian 11 上使用 Nginx 安装 HTTP Git 服务器

有两个配置NAS与linux系统不同:

fastcgi_param SCRIPT_FILENAME     /var/packages/Git/target/libexec/git-core/git-http-backend;
fastcgi_pass  unix:/run/fcgiwrap.sock;
server {
    listen       8082;

    # This is where the repositories live on the server
    root /var/services/homes/user/git_repo;

    access_log   /var/services/homes/weishubin/DEV/logs/git-nginx-access.log;
    error_log   /var/services/homes/weishubin/DEV/logs/git-nginx-error.log;



    location ~ (/.*) {
        auth_basic "Git Login";
        auth_basic_user_file /var/services/homes/user/DEV/htpasswd/passwd;
        include       /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME     /var/packages/Git/target/libexec/git-core/git-http-backend;
        # export all repositories under GIT_PROJECT_ROOT
        fastcgi_param GIT_HTTP_EXPORT_ALL "";
        fastcgi_param GIT_PROJECT_ROOT    /var/services/homes/user/git_repo;
        # fastcgi_param GIT_PROJECT_ROOT    /var/services/web/git_repo;
        fastcgi_param REMOTE_USER $remote_user;
        fastcgi_param PATH_INFO           $1;
        fastcgi_pass  unix:/run/fcgiwrap.sock;
    }
}
06-29 07:23