From: Shane Date: Sun, 11 Jan 2026 00:50:09 +0000 (+0000) Subject: host simple frontend X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=3634fe86843fe03aa9441b512197ef0a6f1cb4e8;p=nutratech%2Fvps-root.git host simple frontend --- diff --git a/etc/nginx/conf.d/git-http.conf b/etc/nginx/conf.d/git-http.conf index a61ff48..0cd0283 100644 --- a/etc/nginx/conf.d/git-http.conf +++ b/etc/nginx/conf.d/git-http.conf @@ -2,22 +2,63 @@ server { listen 80; server_name git.nutra.tk; - # Define the root directory for non-Git content (optional) - root /var/www/html; - index index.html; + # Gitweb UI at root + location / { + root /usr/share/gitweb; + index index.cgi gitweb.cgi; + + location ~ \.css$ { + add_header Content-Type text/css; + } + location ~ \.js$ { + add_header Content-Type application/javascript; + } + location ~ \.png$ { + add_header Content-Type image/png; + } + + # If static file doesn't exist, pass to CGI + try_files $uri @gitweb; + } + + location @gitweb { + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/share/gitweb/gitweb.cgi; + fastcgi_param PATH_INFO $uri; + fastcgi_param GITWEB_CONFIG /etc/gitweb.conf; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + } # Directory for Git repositories set $git_root /srv/git; - # Serve Git repositories under /git/ + # Serve Git repositories under /git/ (Smart HTTP) location ~ ^/git/([^/]+\.git)(/.*)?$ { - include fastcgi_params; + include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; fastcgi_param GIT_PROJECT_ROOT $git_root; - fastcgi_param GIT_HTTP_EXPORT_ALL "1"; # Allow access without git-daemon-export-ok - fastcgi_param PATH_INFO /$1$2; # Repo name + subpath (e.g., /myrepo.git/info/refs) + fastcgi_param GIT_HTTP_EXPORT_ALL "1"; + fastcgi_param PATH_INFO /$1$2; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param QUERY_STRING $query_string; + # Pass remote user for authentication (if we add auth later) + fastcgi_param REMOTE_USER $remote_user; fastcgi_pass unix:/var/run/fcgiwrap.socket; } + + listen 443 ssl; + ssl_certificate /etc/letsencrypt/live/earthyenergy.mooo.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/earthyenergy.mooo.com/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; +} + +server { + if ($host = git.nutra.tk) { + return 301 https://$host$request_uri; + } + + listen 80; + server_name git.nutra.tk; + return 404; }