Created
November 18, 2015 16:26
-
-
Save aelindeman/539195b5ed82c03cddd5 to your computer and use it in GitHub Desktop.
Apache 2.4 configuration for cgit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DocumentRoot /usr/share/cgit | |
<Directory "/usr/share/cgit"> | |
Require all denied | |
<FilesMatch "\.(css|gif|html?|ico|jpe?g|js|png|txt)$"> | |
Require all granted | |
</FilesMatch> | |
</Directory> | |
ScriptAlias /cgi-bin /usr/lib/cgit | |
<Directory "/usr/lib/cgit"> | |
Require all denied | |
<Files "cgit.cgi"> | |
Require all granted | |
</Files> | |
</Directory> | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
# redirect to https | |
<IfModule mod_ssl.c> | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^/?(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
</IfModule> | |
# can't use REQUEST_FILENAME because of passthrough, but this works too | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f | |
RewriteRule ^/?(.*)$ /cgi-bin/cgit.cgi/$1 [PT] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment