diff options
author | hitlerrip <git@hitler.rip> | 2025-08-05 19:11:29 +0200 |
---|---|---|
committer | hitlerrip <git@hitler.rip> | 2025-08-05 19:11:29 +0200 |
commit | 09dd7a17bc15371857f9d3795166ccc6c483097f (patch) | |
tree | 1a838084000b1f458cea05e88a65f116b1dfa48e | |
parent | 91aba6d6a5915882f267ea6648d35f49f99c1534 (diff) | |
download | website-09dd7a17bc15371857f9d3795166ccc6c483097f.tar.gz website-09dd7a17bc15371857f9d3795166ccc6c483097f.tar.bz2 website-09dd7a17bc15371857f9d3795166ccc6c483097f.zip |
cgit
added initial cgit to `run.sh`
-rwxr-xr-x | run.sh | 82 |
1 files changed, 59 insertions, 23 deletions
@@ -127,25 +127,40 @@ sudo certbot --nginx # hitler.rip www.hitler.rip links.hitler.rip git.hitler.rip sudo tee /etc/nginx/sites-available/default << EOF server { + if (\$host = hitler.rip) { + return 301 https://hitler.rip\$request_uri; + } + if (\$host = www.hitler.rip) { + return 301 https://hitler.rip\$request_uri; + } + if (\$host = links.hitler.rip) { + return 301 https://hitler.rip/links\$request_uri; + } + if (\$host = git.hitler.rip) { + return 301 https://git.hitler.rip\$request_uri; + } + listen 80; + listen [::]:80; + serer_name hitler.rip www.hitler.rip links.hitler.rip git.hitler.rip; + return 301 https://hitler.rip\$request_uri; +} + +server { server_name hitler.rip www.hitler.rip links.hitler.rip; if (\$host = links.hitler.rip) { - return 301 https://hitler.rip/links$request_uri; + return 301 https://hitler.rip/links\$request_uri; } if (\$host = www.hitler.rip) { - return 301 https://hitler.rip$request_uri; - } - - if (\$host = git.hitler.rip) { - return 404; + return 301 https://hitler.rip\$request_uri; } root /srv/web; index index.html; location / { - try_files $uri $uri/ =404; + try_files \$uri \$uri/ =404; } - listen [::]:443 ssl ipv6only=on; + listen [::]:443 ssl; listen 443 ssl; ssl_certificate /etc/letsencrypt/live/hitler.rip/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/hitler.rip/privkey.pem; @@ -154,22 +169,23 @@ server { } server { - if (\$host = hitler.rip) { - return 301 https://hitler.rip$request_uri; + server_name git.hitler.rip; + root /usr/share/cgit; + try_files \$uri @cgit; + location @cgit { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi; + fastcgi_param PATH_INFO \$uri; + fastcgi_param QUERY_STRING \$args; + fastcgi_param HTTP_HOST git.hitler.rip; + fastcgi_pass unix:/run/fcgiwrap.socket; } - if (\$host = www.hitler.rip) { - return 301 https://hitler.rip$request_uri; - } - if (\$host = links.hitler.rip) { - return 301 https://hitler.rip/links$request_uri; - } - if (\$host = git.hitler.rip) { - return 301 https://git.hitler.rip$request_uri; - } - listen 80; - listen [::]:80; - serer_name hitler.rip www.hitler.rip links.hitler.rip git.hitler.rip; - return 301 https://hitler.rip$request_uri; + listen [::]:443 ssl; + listen 443 ssl; + ssl_certificate /etc/letsencrypt/live/hitler.rip/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/hitler.rip/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; } EOF sudo mkdir -p /srv/web/ @@ -192,3 +208,23 @@ sudo mkdir -p /srv/pgit/ sudo chown -R git:git /srv/pgit/ git config --global --add safe.directory '*' # to allow the server to clone its own repos echo "[run] git server created. you may now clone the website build script to /srv/build/ and push your website." + +echo "[run] setting up cgit..." +sudo apt install -y cgit fcgiwrap +sudo systemctl enable fcgiwrap +sudo systemctl start fcgiwrap +sudo tee /etc/cgitrc << EOF +css=/cgit.css +logo=/cgit.png +scan-path=/srv/git +virtual-root=/ +about-filter=/usr/lib/cgit/filters/about-formatting.sh +readme=:README.md +EOF +sudo tee -a /usr/share/cgit/cgit.css << EOF +.logo > a > img { + width: 64px; + height: 64px; +} +EOF +echo "[run] cgit server created. you may now replace /usr/share/cgit/cgit.png and /usr/share/cgit/favicon.ico with a custom image." |