User:Halcon/HOWTO cgit uwsgi nginx

HOWTO install and configure cgit + uwsgi + nginx in a domain subdirectory without webapp-config (using OpenRC).

Installing
The package can be installed without dependency on  from halcon-overlay (run by the author of this article).

Alternatively, you could copy the content of www-apps/cgit directory of that overlay to your local overlay and install the package from there.

Configuring
Replace subdirectory, www.your-domain.something, My-Repo, /some/path, Some description, author@some.email with real values:

For the Option 2, content of the file /some/path/project.list could be:

The path /some/path should be readable for the system user nginx and, better of all, for nobody else:

Configuring
Create the main configuration file:

/some/path/uwsgi.cgit.xml syslog

true

nginx nginx

1 	 1

cgi

/usr/lib64/uwsgi/

9

/tmp/uwsgi_cgit.sock 600

127.0.0.7:7777

/usr/share/webapps/cgit/1.2.3-r102/hostroot/cgi-bin

cgit.cgi

This file should be readable for the system user nginx:

Create a non-emperor uwsgi OpenRC service:

Create the configuration file for the service:

(replace /some/path with real value)

Configuring
The corresponding sections of the configuration file /etc/nginx/nginx.conf: http { upstream uwsgi_cgit { server unix:///tmp/uwsgi_cgit.sock; }	server { ...               location ~* ^.+(cgit.(css|png)|favicon.ico) { root /usr/share/webapps/cgit/1.2.3-r102/htdocs; expires 30d; }               location /subdirectory/ { uwsgi_pass uwsgi_cgit; include uwsgi_params; uwsgi_modifier1 9; rewrite ^/subdirectory/(.*)$ /subdirectory/$1?url=/$1 break; } } (replace subdirectory with real value; "root" value MUST BE CHANGED accordingly in case of installing another cgit version)

Testing
Create a testing repo:

Start the service:

Restart nginx:

Try to clone the repo by https: