R
R
Ruslan Bagautdinov2014-04-15 22:13:28
Nginx
Ruslan Bagautdinov, 2014-04-15 22:13:28

How to set up git+nginx to work over HTTP?

It was on apache2 and everything worked completely Clone / Pull and Push.
File /etc/apache2/conf.d/git :

SetEnv GIT_PROJECT_ROOT /srv/git/repos/
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

Alias /git /srv/git/repos

<Directory /usr/lib/git-core>
  Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  AllowOverride None
  Order allow,deny
  Allow from all
  AuthType Basic
  AuthName "Git Server"
  Require valid-user
  AuthUserFile /etc/apache2/git.htpasswd
</Directory>

It became on nginx and only Clone/Pull works, with Push 403 error, what am I doing wrong?
location ~ /git(/.*) {
            access_log /srv/git/log/acees.log;
            error_log /srv/git/log/error.log;
            #auth_basic "Restricted";
            #auth_basic_user_file /etc/nginx/git.htpasswd;
            fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
            include fastcgi_params;
            fastcgi_param GIT_HTTP_EXPORT_ALL "";
            fastcgi_param GIT_PROJECT_ROOT /srv/git/repos;
            fastcgi_param PATH_INFO $1;
            fastcgi_param REMOTE_USER $remote_user;
            fastcgi_pass unix:/var/run/fcgiwrap.socket;
        }

Help me write the correct config for nginx .

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Drummer_hard, 2014-04-16
@Drummer_hard

In the error.log, what do the request URLs to /git/ look like? can you write here?

Y
Yuri Bortnik, 2016-01-29
@DrakeMazzy

nginx must be built with modules dav dav-ext
and added to location ~ /git(/.*) {

dav_methods PUT DELETE MKCOL COPY MOVE;
 dav_ext_methods PROPFIND OPTIONS;

taken here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question