summaryrefslogtreecommitdiff
path: root/cgit
diff options
context:
space:
mode:
authorrafa_99 <raroma09@gmail.com>2022-04-24 01:32:53 +0100
committerrafa_99 <raroma09@gmail.com>2022-04-24 01:32:53 +0100
commitfeac620aaf34c903a432ddd02404fd17456f6705 (patch)
tree9afd8a6849ce55424510a63214a65eed07b205a6 /cgit
parent57901bc2dbbd276505e1a660ed94b255ec3457dd (diff)
Updated webserver structure into subdirectories
Diffstat (limited to 'cgit')
-rw-r--r--cgit/cgitrc12
-rwxr-xr-xcgit/deploy34
-rw-r--r--cgit/nginx/pages/cgit.conf10
-rw-r--r--cgit/nginx/sites-available/server12
4 files changed, 68 insertions, 0 deletions
diff --git a/cgit/cgitrc b/cgit/cgitrc
new file mode 100644
index 0000000..b53d3ef
--- /dev/null
+++ b/cgit/cgitrc
@@ -0,0 +1,12 @@
+#
+# cgit config
+# see cgitrc(5) for details
+
+css=/cgit.css
+logo=/cgit.png
+
+virtual-root=/git
+scan-path=/srv/git/
+
+root-title=Sneed's Feed and Seed Git Server
+root-desc=Formerly Chucks.
diff --git a/cgit/deploy b/cgit/deploy
new file mode 100755
index 0000000..f00460d
--- /dev/null
+++ b/cgit/deploy
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Installing dependencies
+sudo apt install -y git nginx fcgiwrap cgit
+
+# Git
+## Creating and setting up user
+sudo adduser git
+
+## Setting up ssh
+mkdir .ssh && chmod 700 .ssh
+echo "DONT FORGET TO ADD YOUR SSH KEYS TO ~/.ssh/authorized_keys AND CHMOD 600 IT"
+
+## Configuring git
+sudo mkdir -p /srv/git
+sudo -H chown git:git /srv/git/
+
+# Cgit
+sudo -H cp -rf cgitrc /etc/
+
+# Nginx
+sudo -H mkdir -p /etc/nginx/certs
+sudo -H cp -rf nginx/ /etc/
+sudo -H ln -s /etc/nginx/sites-available/server /etc/nginx/sites-enabled/server
+sudo -H sed -i s:"$(grep access_log /etc/nginx/nginx.conf | awk '{print $2}' )":\/dev\/null\;:g /etc/nginx/nginx.conf
+sudo -H sed -i s:"$(grep error_log /etc/nginx/nginx.conf | awk '{print $2}' )":\/dev\/null\;:g /etc/nginx/nginx.conf
+
+# SSL
+openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -extensions EXT -config <( printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
+sudo mv localhost.* /etc/nginx/certs
+
+# Restarting services
+sudo -H systemctl restart nginx
+sudo -H systemctl enable nginx
diff --git a/cgit/nginx/pages/cgit.conf b/cgit/nginx/pages/cgit.conf
new file mode 100644
index 0000000..9d3f7ef
--- /dev/null
+++ b/cgit/nginx/pages/cgit.conf
@@ -0,0 +1,10 @@
+root /usr/share/cgit ;
+location /git
+{
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
+ fastcgi_pass unix:/run/fcgiwrap.socket;
+ fastcgi_param PATH_INFO $fastcgi_path_info;
+ fastcgi_param QUERY_STRING $args;
+ fastcgi_split_path_info ^(/git/?)(.+)$;
+}
diff --git a/cgit/nginx/sites-available/server b/cgit/nginx/sites-available/server
new file mode 100644
index 0000000..ba75367
--- /dev/null
+++ b/cgit/nginx/sites-available/server
@@ -0,0 +1,12 @@
+server
+{
+ server_name hostname.local;
+
+ listen 443 ssl;
+ listen [::]:443 ssl;
+
+ ssl_certificate /etc/nginx/certs/localhost.crt;
+ ssl_certificate_key /etc/nginx/certs/localhost.key;
+
+ include pages/*.conf;
+}