git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
* How to get gitweb setup with nginx + uwsgi?
@ 2019-08-12 15:09 koocr
  2019-08-12 19:16 ` Konstantin Ryabitsev
  0 siblings, 1 reply; 3+ messages in thread
From: koocr @ 2019-08-12 15:09 UTC (permalink / raw)
  To: git

Hi all.

I'm setting up a local Git server, with Gitweb + Gitolite.

The gitolite wrapper is installed & working.  Now I'm working on the Gitweb frontend.

I run Nginx as my webserver.  Usually with PHP, using fpm.

Gitweb's gitweb.cgi looks like it needs perl CGI.

For perl cgi I'm trying to get it working with UWSGI,

	https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html
	https://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#example

I installed

	git --version
		git version 2.22.0
	ls -al /usr/share/gitweb/gitweb.cgi
		-rwxr-xr-x 1 root root 247K Jul 24 05:27 /usr/share/gitweb/gitweb.cgi
	grep "\$version =" /usr/share/gitweb/gitweb.cgi
		our $version = "2.22.0";
	nginx -v
		nginx version: nginx/1.17.1 
	uwsgi --version
		2.0.18

I set up the nginx vhost

	server { 
	    listen 127.0.0.1:60080 http2;
	    root /usr/share/gitweb;
	    index  gitweb.cgi;

	    location / {
	        try_files $uri $uri/ @gitweb;
	    }
	    location @gitweb {
	        root /usr/share/gitweb;
	        include uwsgi_params;
	        gzip off;
	        uwsgi_param UWSGI_SCRIPT gitweb;
	        uwsgi_param GITWEB_CONFIG /etc/gitweb/gitweb.conf;
	        uwsgi_pass unix:/run/uwsgi/uwsgi.sock;
	        uwsgi_modifier1 5;
	    }
	}

and the uwsgi server

	/etc/uwsgi/uwsgi.ini
		[uwsgi]
		strict = 1

		master = true
		processes = 2

		binary-path = /usr/sbin/uwsgi
		plugin-dir = /usr/lib64/uwsgi
		logto = /var/log/uwsgi/uwsgi.log

		uid = wwwrun
		gid = www
		umask = 022

		uwsgi-socket = /run/uwsgi/uwsgi.sock
		chmod-socket = 660
		chown-socket = wwwrun:www

		plugins = http,psgi
		chdir = /usr/share/gitweb
		psgi = gitweb.cgi


nginx & uwsgi services are both running

	ps aux | egrep "nginx|uwsgi"
		wwwrun   17463  0.0  0.1  89468 23704 ?        Ss   07:03   0:00 /usr/sbin/uwsgi --autoload --ini /etc/uwsgi/uwsgi.ini
		wwwrun   17465  0.0  0.1  97664 17184 ?        Sl   07:03   0:00 /usr/sbin/uwsgi --autoload --ini /etc/uwsgi/uwsgi.ini
		wwwrun   17468  0.0  0.1  97664 17184 ?        Sl   07:03   0:00 /usr/sbin/uwsgi --autoload --ini /etc/uwsgi/uwsgi.ini
		root     18006  0.0  0.0 211264  4276 ?        Ss   07:10   0:00 nginx: master process /opt/nginx/sbin/nginx -c /etc/nginx/nginx.conf -g pid /run/nginx.pid;
		wwwrun   18007  0.0  0.0 211416  5492 ?        S    07:10   0:00 nginx: worker process
		wwwrun   18008  0.0  0.0 212068 10300 ?        S    07:10   0:00 nginx: worker process
		wwwrun   18009  0.0  0.0 211416  5492 ?        S    07:10   0:00 nginx: worker process
		wwwrun   18011  0.0  0.0 211416  5492 ?        S    07:10   0:00 nginx: worker process
		wwwrun   18012  0.0  0.0 211452  5052 ?        S    07:10   0:00 nginx: cache manager process

	ls -al /run/uwsgi/uwsgi.sock
		srw-rw---- 1 wwwrun www  0 Aug 12 07:03 /run/uwsgi/uwsgi.sock=

when I go to the site

	http://127.0.0.1:60080/

I just get the script listing in the browser

	#!/usr/bin/perl
	 
	# gitweb - simple web interface to track changes in git repositories
	#
	# (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>
	# (C) 2005, Christian Gierke
	#
	# This program is licensed under the GPLv2
	 
	use 5.008;
	use strict;
	use warnings;
	...

no errors anywhere, just the script display.

I'm missing something basic since it's not running the script. :-/

Anyone have any experience with gitweb + uwsgi on nginx?  Or know a good working example?

Thanks!



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to get gitweb setup with nginx + uwsgi?
  2019-08-12 15:09 How to get gitweb setup with nginx + uwsgi? koocr
@ 2019-08-12 19:16 ` Konstantin Ryabitsev
  2019-08-12 21:49   ` koocr
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Ryabitsev @ 2019-08-12 19:16 UTC (permalink / raw)
  To: koocr; +Cc: git

On Mon, Aug 12, 2019 at 08:09:22AM -0700, koocr@mailc.net wrote:
>Hi all.
>
>I'm setting up a local Git server, with Gitweb + Gitolite.

We have it working in a similar configuration, but with CGit instead of 
GitWeb. Unless you have specific requirements to run GitWeb, I recommend 
you use CGit for your web frontend, as it offers many features GitWeb 
doesn't, such as caching -- plus it works really well with uwsgi 
(git.kernel.org runs in that configuration).

Best,
-K


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to get gitweb setup with nginx + uwsgi?
  2019-08-12 19:16 ` Konstantin Ryabitsev
@ 2019-08-12 21:49   ` koocr
  0 siblings, 0 replies; 3+ messages in thread
From: koocr @ 2019-08-12 21:49 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: git

Hi,

On Mon, Aug 12, 2019, at 12:16 PM, Konstantin Ryabitsev wrote:
> We have it working in a similar configuration, but with CGit instead of 
> GitWeb. Unless you have specific requirements to run GitWeb, I recommend 
> you use CGit for your web frontend, as it offers many features GitWeb 
> doesn't, such as caching -- plus it works really well with uwsgi 
> (git.kernel.org runs in that configuration).


Didn't realize that!  

I'd picked gitweb in the first place as I figured, being part of git, that kernel project would be using it.

Clearly I'm wrong.

Switching to CGit now.  Thanks for the suggestion.

I don't use Arch (Opensuse User), but am trying to follow their CGit + UWSGI + Gitolite docs:

https://wiki.archlinux.org/index.php/Cgit#Using_uwsgi

Since my distro pkgs have different paths, systemd setup, etc. having some challenges getting a everything-working-together config setup.  That'll just take some reading and staring ! ;-)

If you know of any other good examples , please share :-)

TA!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 15:09 How to get gitweb setup with nginx + uwsgi? koocr
2019-08-12 19:16 ` Konstantin Ryabitsev
2019-08-12 21:49   ` koocr

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox