{"thread":{"id":"51626","subject":"How to get gitweb setup with nginx + uwsgi?","startedAt":"2019-08-12T15:09:26Z","lastAt":"2019-08-12T21:49:07Z","messageCount":3,"participants":["koocr@mailc.net","Konstantin Ryabitsev"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"380306","messageId":"88cc039d-2bf8-4c1d-90c4-486ff661c1e9@www.fastmail.com","threadId":"51626","inReplyTo":null,"subject":"How to get gitweb setup with nginx + uwsgi?","fromName":"","fromEmail":"koocr@mailc.net","sentAt":"2019-08-12T15:09:22Z","receivedAt":"2019-08-12T15:09:26Z","isPatch":false,"sender":{"key":"koocr@mailc.net","avatar":null},"body":"Hi all.\n\nI'm setting up a local Git server, with Gitweb + Gitolite.\n\nThe gitolite wrapper is installed & working.  Now I'm working on the Gitweb frontend.\n\nI run Nginx as my webserver.  Usually with PHP, using fpm.\n\nGitweb's gitweb.cgi looks like it needs perl CGI.\n\nFor perl cgi I'm trying to get it working with UWSGI,\n\n\thttps://uwsgi-docs.readthedocs.io/en/latest/Nginx.html\n\thttps://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#example\n\nI installed\n\n\tgit --version\n\t\tgit version 2.22.0\n\tls -al /usr/share/gitweb/gitweb.cgi\n\t\t-rwxr-xr-x 1 root root 247K Jul 24 05:27 /usr/share/gitweb/gitweb.cgi\n\tgrep \"\\$version =\" /usr/share/gitweb/gitweb.cgi\n\t\tour $version = \"2.22.0\";\n\tnginx -v\n\t\tnginx version: nginx/1.17.1 \n\tuwsgi --version\n\t\t2.0.18\n\nI set up the nginx vhost\n\n\tserver { \n\t    listen 127.0.0.1:60080 http2;\n\t    root /usr/share/gitweb;\n\t    index  gitweb.cgi;\n\n\t    location / {\n\t        try_files $uri $uri/ @gitweb;\n\t    }\n\t    location @gitweb {\n\t        root /usr/share/gitweb;\n\t        include uwsgi_params;\n\t        gzip off;\n\t        uwsgi_param UWSGI_SCRIPT gitweb;\n\t        uwsgi_param GITWEB_CONFIG /etc/gitweb/gitweb.conf;\n\t        uwsgi_pass unix:/run/uwsgi/uwsgi.sock;\n\t        uwsgi_modifier1 5;\n\t    }\n\t}\n\nand the uwsgi server\n\n\t/etc/uwsgi/uwsgi.ini\n\t\t[uwsgi]\n\t\tstrict = 1\n\n\t\tmaster = true\n\t\tprocesses = 2\n\n\t\tbinary-path = /usr/sbin/uwsgi\n\t\tplugin-dir = /usr/lib64/uwsgi\n\t\tlogto = /var/log/uwsgi/uwsgi.log\n\n\t\tuid = wwwrun\n\t\tgid = www\n\t\tumask = 022\n\n\t\tuwsgi-socket = /run/uwsgi/uwsgi.sock\n\t\tchmod-socket = 660\n\t\tchown-socket = wwwrun:www\n\n\t\tplugins = http,psgi\n\t\tchdir = /usr/share/gitweb\n\t\tpsgi = gitweb.cgi\n\n\nnginx & uwsgi services are both running\n\n\tps aux | egrep \"nginx|uwsgi\"\n\t\twwwrun   17463  0.0  0.1  89468 23704 ?        Ss   07:03   0:00 /usr/sbin/uwsgi --autoload --ini /etc/uwsgi/uwsgi.ini\n\t\twwwrun   17465  0.0  0.1  97664 17184 ?        Sl   07:03   0:00 /usr/sbin/uwsgi --autoload --ini /etc/uwsgi/uwsgi.ini\n\t\twwwrun   17468  0.0  0.1  97664 17184 ?        Sl   07:03   0:00 /usr/sbin/uwsgi --autoload --ini /etc/uwsgi/uwsgi.ini\n\t\troot     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;\n\t\twwwrun   18007  0.0  0.0 211416  5492 ?        S    07:10   0:00 nginx: worker process\n\t\twwwrun   18008  0.0  0.0 212068 10300 ?        S    07:10   0:00 nginx: worker process\n\t\twwwrun   18009  0.0  0.0 211416  5492 ?        S    07:10   0:00 nginx: worker process\n\t\twwwrun   18011  0.0  0.0 211416  5492 ?        S    07:10   0:00 nginx: worker process\n\t\twwwrun   18012  0.0  0.0 211452  5052 ?        S    07:10   0:00 nginx: cache manager process\n\n\tls -al /run/uwsgi/uwsgi.sock\n\t\tsrw-rw---- 1 wwwrun www  0 Aug 12 07:03 /run/uwsgi/uwsgi.sock=\n\nwhen I go to the site\n\n\thttp://127.0.0.1:60080/\n\nI just get the script listing in the browser\n\n\t#!/usr/bin/perl\n\t \n\t# gitweb - simple web interface to track changes in git repositories\n\t#\n\t# (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>\n\t# (C) 2005, Christian Gierke\n\t#\n\t# This program is licensed under the GPLv2\n\t \n\tuse 5.008;\n\tuse strict;\n\tuse warnings;\n\t...\n\nno errors anywhere, just the script display.\n\nI'm missing something basic since it's not running the script. :-/\n\nAnyone have any experience with gitweb + uwsgi on nginx?  Or know a good working example?\n\nThanks!\n\n\n"},{"id":"380328","messageId":"20190812191610.GA24499@chatter.i7.local","threadId":"51626","inReplyTo":"88cc039d-2bf8-4c1d-90c4-486ff661c1e9@www.fastmail.com","subject":"Re: How to get gitweb setup with nginx + uwsgi?","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2019-08-12T19:16:10Z","receivedAt":"2019-08-12T19:16:14Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"On Mon, Aug 12, 2019 at 08:09:22AM -0700, koocr@mailc.net wrote:\n>Hi all.\n>\n>I'm setting up a local Git server, with Gitweb + Gitolite.\n\nWe have it working in a similar configuration, but with CGit instead of \nGitWeb. Unless you have specific requirements to run GitWeb, I recommend \nyou use CGit for your web frontend, as it offers many features GitWeb \ndoesn't, such as caching -- plus it works really well with uwsgi \n(git.kernel.org runs in that configuration).\n\nBest,\n-K\n\n"},{"id":"380349","messageId":"61e897e6-ec5d-4973-b3e0-8e7c997b7bc6@www.fastmail.com","threadId":"51626","inReplyTo":"20190812191610.GA24499@chatter.i7.local","subject":"Re: How to get gitweb setup with nginx + uwsgi?","fromName":"","fromEmail":"koocr@mailc.net","sentAt":"2019-08-12T21:49:03Z","receivedAt":"2019-08-12T21:49:07Z","isPatch":false,"sender":{"key":"koocr@mailc.net","avatar":null},"body":"Hi,\n\nOn Mon, Aug 12, 2019, at 12:16 PM, Konstantin Ryabitsev wrote:\n> We have it working in a similar configuration, but with CGit instead of \n> GitWeb. Unless you have specific requirements to run GitWeb, I recommend \n> you use CGit for your web frontend, as it offers many features GitWeb \n> doesn't, such as caching -- plus it works really well with uwsgi \n> (git.kernel.org runs in that configuration).\n\n\nDidn't realize that!  \n\nI'd picked gitweb in the first place as I figured, being part of git, that kernel project would be using it.\n\nClearly I'm wrong.\n\nSwitching to CGit now.  Thanks for the suggestion.\n\nI don't use Arch (Opensuse User), but am trying to follow their CGit + UWSGI + Gitolite docs:\n\nhttps://wiki.archlinux.org/index.php/Cgit#Using_uwsgi\n\nSince 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 ! ;-)\n\nIf you know of any other good examples , please share :-)\n\nTA!\n"}]}