7
7
}
8
8
9
9
http {
10
-
11
10
sendfile on;
12
11
tcp_nopush on;
13
12
tcp_nodelay on;
@@ -32,19 +31,32 @@ http {
32
31
root /var/www/gitlist;
33
32
index index .php;
34
33
35
- auth_basic "Restricted" ;
36
- auth_basic_user_file /ng-auth/htpasswd;
37
-
38
- #git SMART HTTP
39
- location ~ /git( /.*\.git.*) {
40
- client_max_body_size 0;
41
- fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http -backend;
42
- fastcgi_param GIT_HTTP_EXPORT_ALL "" ;
43
- fastcgi_param GIT_PROJECT_ROOT /repos;
44
- fastcgi_param PATH_INFO $1 ;
45
- fastcgi_param REMOTE_USER $remote_user ;
46
- include /etc/nginx/fastcgi_params;
47
- fastcgi_pass unix:/var/run/fcgiwrap.socket;
34
+ location ~ /git( /.*) {
35
+ if ( $arg_service = git-receive-pack) {
36
+ rewrite /git( /.*) /git_write$1 last;
37
+ }
38
+
39
+ if ( $uri ~ ^/git/.*/git-receive-pack$) {
40
+ rewrite /git( /.*) /git_write$1 last;
41
+ }
42
+
43
+ if ( $arg_service = git-upload-pack) {
44
+ rewrite /git( /.*) /git_read$1 last;
45
+ }
46
+
47
+ if ( $uri ~ ^/git/.*/git-upload-pack$) {
48
+ rewrite /git( /.*) /git_read$1 last;
49
+ }
50
+ }
51
+
52
+ location ~ /git_read( /.*) {
53
+ include git-http -backend.conf;
54
+ }
55
+
56
+ location ~ /git_write( /.*) {
57
+ auth_basic "Pushing to Git repositories is restricted" ;
58
+ auth_basic_user_file /ng-auth/htpasswd;
59
+ include git-http -backend.conf;
48
60
}
49
61
50
62
#robots
0 commit comments