aboutsummaryrefslogtreecommitdiff
path: root/pages/logs/cgit-nginx-ubuntu
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2021-07-21 00:47:36 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2021-07-21 00:47:36 -0500
commit9e54416ae5e095ef5d47eb0c7a642894dddf46aa (patch)
treef5deba5b0a5f2c8c7d43c2e544e9faa9cba09f70 /pages/logs/cgit-nginx-ubuntu
parent8bb2be5a99bae8b274c403afcf0cfa270cde25ce (diff)
downloadhomepage-9e54416ae5e095ef5d47eb0c7a642894dddf46aa.tar.xz
homepage-9e54416ae5e095ef5d47eb0c7a642894dddf46aa.zip
Rename posts -> logs
Diffstat (limited to 'pages/logs/cgit-nginx-ubuntu')
-rw-r--r--pages/logs/cgit-nginx-ubuntu/cgit-nginx-ubuntu.md96
-rw-r--r--pages/logs/cgit-nginx-ubuntu/index.tsx12
2 files changed, 108 insertions, 0 deletions
diff --git a/pages/logs/cgit-nginx-ubuntu/cgit-nginx-ubuntu.md b/pages/logs/cgit-nginx-ubuntu/cgit-nginx-ubuntu.md
new file mode 100644
index 0000000..c225bd4
--- /dev/null
+++ b/pages/logs/cgit-nginx-ubuntu/cgit-nginx-ubuntu.md
@@ -0,0 +1,96 @@
+Installing cGit behind NGINX on Ubuntu
+======================================
+
+[cGit](https://git.zx2c4.com/cgit/about/) is a fast web interface based on the CGI specification. It is lightweight and doesn't require a database or web authentication system.
+
+It's easy to configure. For some reason, all the online guides for Ubuntu decided they needed to compile it from scratch and write their own start scripts in a mix of perl and bash. You don't need superhero sysadmin skills from the late 90s. All components are packaged with systemd units... there is a better way...
+
+### 1. Install `cgit` and `fcgiwrap`.
+
+`fcgiwrap` will create a socket NGINX can use to pass the CGI variables to cGit:
+```
+sudo apt install fcgiwrap
+sudo apt install cgit
+```
+
+### 2. Modify the `cgitrc` file under `/etc/cgitrc` to your liking:
+```
+# See cgitrc(5)
+# prepend this string to every url
+virtual-root=/
+enable-index-links=1
+enable-commit-graph=1
+
+root-title=My Git Repos
+root-desc=I exclusivly write code in Smalltalk-71
+logo=/assets/my_custom_logo.png
+
+# Add site-specific configuration
+# ...
+
+```
+
+### 3. Optionally create an assets directory and add your custom logo / css:
+```
+mkdir /var/www/html/assets
+cp my_custom_logo.png /var/www/html/assets
+```
+
+### 4. Configure NGINX
+
+Add the site to NGINX. This launches the `cgit.cgi` executable passing it to the `fcgiwrap` socket:
+```conf
+echo >/etc/nginx/sites-available/cgit.conf <<EOF
+server {
+ listen 80;
+
+ server_name git.domain.com;
+ server_name www.git.domain.com;
+
+ root /usr/share/cgit;
+
+ # Maintainer overridden assets will live in /assets
+ # This allows you to change add a custom logo or modified CSS
+ # See cgitrc(5)
+ location ~* /assets {
+ root /var/www/html;
+ expires 30d;
+ }
+
+ # Fallback to static assets included by cGit
+ location ~* ^.+\.(css|png|ico)$ {
+ root /usr/share/cgit;
+ expires 30d;
+ }
+
+ try_files $uri @cgit;
+
+ location @cgit {
+ fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
+ fastcgi_param PATH_INFO $uri;
+ fastcgi_param QUERY_STRING $args;
+ fastcgi_param HTTP_HOST $server_name;
+ fastcgi_pass unix:/run/fcgiwrap.socket;
+ }
+
+ access_log /var/log/nginx/access.log;
+ error_log /var/log/nginx/error.log warn;
+}
+EOF
+```
+
+### 4. Enable the site:
+```bash
+ln -s /etc/nginx/sites-available/git.conf /etc/nginx/sites-enabled/cgit.conf
+```
+
+Note: all files in sites-enabled should be included in `nginx.conf`'s http section:
+```conf
+include /etc/nginx/sites-enabled/*;
+```
+
+### 5. Restart NGINX
+
+```
+sudo systemctl restart nginx
+```
diff --git a/pages/logs/cgit-nginx-ubuntu/index.tsx b/pages/logs/cgit-nginx-ubuntu/index.tsx
new file mode 100644
index 0000000..ccfe5d2
--- /dev/null
+++ b/pages/logs/cgit-nginx-ubuntu/index.tsx
@@ -0,0 +1,12 @@
+// @ts-ignore
+import md from './cgit-nginx-ubuntu.md';
+import MarkdownPage from '../../../templates/MarkdownPage';
+
+export default function cGitNGINXUbuntu() {
+ return (
+ <MarkdownPage
+ md={md}
+ path={'/logs/cgit-nginx-ubuntu'}
+ />
+ );
+} \ No newline at end of file