nginx里面的git server和django程序

时间:2018-02-10 13:19:38

标签: django git nginx gunicorn git-server

我想在我的django程序中运行一个git服务器。我的nginx配置是这样的:

server{
    listen 192.168.1.250:80;

    root /var/www/html/git;            

    location /server\.git {           

        client_max_body_size 0; # Git pushes can be massive, just to make sure nginx doesn't suddenly cut the connection add this.
        auth_basic "Git Login"; # Whatever text will do.
        auth_basic_user_file "/var/www/html/git/htpasswd";
        include /etc/nginx/fastcgi_params; # Include the default fastcgi configs
        fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; # Tells fastcgi to pass the request to the git http backend executable
        fastcgi_param GIT_HTTP_EXPORT_ALL "";
        fastcgi_param GIT_PROJECT_ROOT /var/www/html/git; # /var/www/git is the location of all of your git repositories.
        fastcgi_param REMOTE_USER $remote_user;
        fastcgi_param PATH_INFO $1; # Takes the capture group from our location directive and gives git that.
        fastcgi_pass  unix:/var/run/fcgiwrap.socket; # Pass the request to fastcgi
    }

    location / {
        include proxy_params;
        proxy_pass http://192.168.1.250:8000;            
    }

}

我的django程序运行正常,但对于git服务器,我无法打开它。

但是当我改变django程序的位置时,它们都能正常工作。

location /user {
       include proxy_params;
       proxy_pass http://192.168.1.250:8000;            
}

我想只使用" /"而不是" /" +字符串。我该怎么办?

0 个答案:

没有答案