Open link in a new tab

Content

Expand project menu

Git on NGINX

Hello !

A lot of nginx related Thread are unanswersd but I try.

OpenProject as Deb with Nginx is working pretty fine (Proxy not passenger). But I need to get GIT working. Here are only settings for Apache and I’m no nginx specialist to translate them right. Any Ideas?

My nginx config: (Working)

server {
    listen 443;
    server_name *.mechsphere.com www.mechsphere.com mechsphere.com;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/mechsphere.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mechsphere.com/privkey.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    # Fix 'The Logjam Attack'.
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-R$
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/ssl/dh2048_param.pem;

    index index.php index.html;

location / {
        proxy_pass http://127.0.0.1:6000;
        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-for $remote_addr;
        proxy_redirect  off;
        proxy_connect_timeout 300;
    }
}

———————————————————————————————————————-
Openproject apache Git config: /etc/openproject/addons/apache2/includes/vhost/git_smart_http.conf

ProxyPass /git/ !

# see https://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html for details
# needs mod_cgi to work -> a2enmod cgi
SetEnv GIT_PROJECT_ROOT "/var/db/openproject/git"

# Allow all repositories within the root to be exported
# depending on the authorization of OpenProject
SetEnv GIT_HTTP_EXPORT_ALL

# Set the remote user based on the redirect.
# If not set, receive-pack service will be disabled by default.
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER

ScriptAlias /git/ "/usr/lib/git-core/git-http-backend/"
<Location /git/>
  ErrorDocument 401 default
  ErrorDocument 403 default
  ErrorDocument 404 default

  AuthType Basic
  AuthName "OpenProject GIT"
  Require valid-user

  <IfModule !mod_authz_core.c>
    Order deny,allow
    Allow from all
  </IfModule>

  PerlAccessHandler Apache::OpenProjectAuthentication::access_handler
  PerlAuthenHandler Apache::OpenProjectAuthentication::authen_handler

  OpenProjectGitSmartHttp yes
  OpenProjectUrl 'http://127.0.0.1:6000/'
  OpenProjectApiKey 'VClaKbON6cId2xFvlRmsgWwcZ2FYxxxx'
</Location>

————————————————————————————————
Any Ideas how to translate

Message actions

Hi Roland,

Git on OpenProject depends on a perl authentication wrapper that Apache gives us to process requests to a particular resource. I don’t know any nginx counterpart to use git over http.

An alternative would be to use gitolite that I wrote a plugin for a while back, however I currently do not maintain it anymore (it may or may not work)

https://github.com/oliverguenther/openproject-revisions_git/

Best,
Oliver