diff options
| author | RATDAD <lambda@disroot.org> | 2025-12-13 21:00:08 -0500 |
|---|---|---|
| committer | RATDAD <lambda@disroot.org> | 2025-12-13 21:00:08 -0500 |
| commit | 00dffa8cf5cac8322cb47f2222e424d3960e7939 (patch) | |
| tree | 7db0460694037b063f97058ecb9eb664b6162b45 /etc/httpd/conf | |
| parent | de8d06726cae205ead43f8b1ac07ecc59a07363b (diff) | |
| download | cgit-docker-00dffa8cf5cac8322cb47f2222e424d3960e7939.tar.gz cgit-docker-00dffa8cf5cac8322cb47f2222e424d3960e7939.tar.bz2 cgit-docker-00dffa8cf5cac8322cb47f2222e424d3960e7939.zip | |
Added Git Smart HTTP Support
Diffstat (limited to 'etc/httpd/conf')
| -rw-r--r-- | etc/httpd/conf/httpd.conf | 76 |
1 files changed, 55 insertions, 21 deletions
diff --git a/etc/httpd/conf/httpd.conf b/etc/httpd/conf/httpd.conf index 3b6da71..675241d 100644 --- a/etc/httpd/conf/httpd.conf +++ b/etc/httpd/conf/httpd.conf @@ -16,7 +16,14 @@ LoadModule dir_module modules/mod_dir.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule alias_module modules/mod_alias.so LoadModule mpm_prefork_module modules/mod_mpm_prefork.so - +LoadModule env_module modules/mod_env.so +LoadModule headers_module modules/mod_headers.so +LoadModule expires_module modules/mod_expires.so +# And Basic Auth Modules +LoadModule auth_basic_module modules/mod_auth_basic.so +LoadModule authn_core_module modules/mod_authn_core.so +LoadModule authn_file_module modules/mod_authn_file.so +LoadModule authz_user_module modules/mod_authz_user.so # Load CGI Module <IfModule !mpm_prefork_module> LoadModule cgid_module modules/mod_cgid.so @@ -25,41 +32,68 @@ LoadModule mpm_prefork_module modules/mod_mpm_prefork.so LoadModule cgi_module modules/mod_cgi.so </IfModule> -# And Basic Auth Modules -LoadModule auth_basic_module modules/mod_auth_basic.so -LoadModule authn_core_module modules/mod_authn_core.so -LoadModule authn_file_module modules/mod_authn_file.so -LoadModule authz_user_module modules/mod_authz_user.so - # # Server config -Listen 0.0.0.0:80 +Listen 80 ServerName localhost -ServerAdmin root@localhost EnableSendFile on AddDefaultCharset UTF-8 TypesConfig /etc/mime.types MIMEMagicFile conf/magic AddHandler cgi-script .cgi +# +# Log Config +LogLevel warn +LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %b" common +ErrorLog "logs/error_log" +ScriptLog logs/git-http-debug.log +CustomLog "logs/access_log" combined + +# +# Git Smart HTTP Support (if enabled) +PassEnv GIT_HTTP_AUTH_FILE +IncludeOptional conf.d/git-http.conf + +# # Always wear protection. <Directory /> - Require all denied + Require all granted </Directory> -# NOTE: Alias matcher MUST end in /, not /cgit.cgi. It WILL break otherwise. -# ALSO: "cgitrc must have a virtual-root=/". -# Remove /cgit.cgi/ from url paths. -ScriptAlias "/" "/srv/www/htdocs/cgit/cgit.cgi/" -<Directory "/srv/www/htdocs/cgit/"> - DirectoryIndex cgit.cgi - AllowOverride None - Options +ExecCGI +FollowSymLinks - SetHandler cgi-script +# +# ALSO: cgitrc must have this: virtual-root=/ +DocumentRoot "/srv/www/htdocs/cgit" +<Directory "/srv/www/htdocs/cgit"> Require all granted + # -Indexes here is not strictly necessary; + # Added for good hygiene + Options +ExecCGI -Indexes + DirectoryIndex cgit.cgi + AllowOverride All + + RewriteEngine On + + # Hard stop: never rewrite Git HTTP requests. + RewriteRule ^.+/(git-upload-pack|git-receive-pack|info/refs)$ - [END] + + # Serve static files directly. + RewriteCond %{REQUEST_FILENAME} -f + RewriteRule ^ - [END] + + # Let cgit handle everything else (and stay off my url). + RewriteRule ^(.*)$ cgit.cgi/$1 [END] + + # Cache static assets + ExpiresActive On + <FilesMatch "\.(css|js|png|ico)$"> + ExpiresDefault "access plus 30 days" + Header set Cache-Control "public, max-age=2592000, immutable" + </FilesMatch> </Directory> -# Deny access to .htaccess/.htpasswd +# Deny access to .htaccess/.htpasswd. <Files ".ht"> Require all denied -</Files>
\ No newline at end of file +</Files> |
