1ServerName dummy
2PidFile httpd.pid
3DocumentRoot www
4LogFormat "%h %l %u %t \"%r\" %>s %b" common
5CustomLog access.log common
6ErrorLog error.log
7<IfModule !mod_log_config.c>
8 LoadModule log_config_module modules/mod_log_config.so
9</IfModule>
10<IfModule !mod_alias.c>
11 LoadModule alias_module modules/mod_alias.so
12</IfModule>
13<IfModule !mod_cgi.c>
14 LoadModule cgi_module modules/mod_cgi.so
15</IfModule>
16<IfModule !mod_env.c>
17 LoadModule env_module modules/mod_env.so
18</IfModule>
19<IfModule !mod_rewrite.c>
20 LoadModule rewrite_module modules/mod_rewrite.so
21</IFModule>
22<IfModule !mod_version.c>
23 LoadModule version_module modules/mod_version.so
24</IfModule>
25<IfModule !mod_headers.c>
26 LoadModule headers_module modules/mod_headers.so
27</IfModule>
28<IfModule !mod_setenvif.c>
29 LoadModule setenvif_module modules/mod_setenvif.so
30</IfModule>
31
32<IfVersion < 2.4>
33LockFile accept.lock
34</IfVersion>
35
36<IfVersion < 2.1>
37<IfModule !mod_auth.c>
38 LoadModule auth_module modules/mod_auth.so
39</IfModule>
40</IfVersion>
41
42<IfVersion >= 2.1>
43<IfModule !mod_auth_basic.c>
44 LoadModule auth_basic_module modules/mod_auth_basic.so
45</IfModule>
46<IfModule !mod_authn_file.c>
47 LoadModule authn_file_module modules/mod_authn_file.so
48</IfModule>
49<IfModule !mod_authz_user.c>
50 LoadModule authz_user_module modules/mod_authz_user.so
51</IfModule>
52<IfModule !mod_authz_host.c>
53 LoadModule authz_host_module modules/mod_authz_host.so
54</IfModule>
55</IfVersion>
56
57<IfVersion >= 2.4>
58<IfModule !mod_authn_core.c>
59 LoadModule authn_core_module modules/mod_authn_core.so
60</IfModule>
61<IfModule !mod_authz_core.c>
62 LoadModule authz_core_module modules/mod_authz_core.so
63</IfModule>
64<IfModule !mod_access_compat.c>
65 LoadModule access_compat_module modules/mod_access_compat.so
66</IfModule>
67<IfModule !mod_mpm_prefork.c>
68 LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
69</IfModule>
70<IfModule !mod_unixd.c>
71 LoadModule unixd_module modules/mod_unixd.so
72</IfModule>
73</IfVersion>
74
75PassEnv GIT_VALGRIND
76PassEnv GIT_VALGRIND_OPTIONS
77PassEnv GNUPGHOME
78PassEnv ASAN_OPTIONS
79PassEnv GIT_TRACE
80PassEnv GIT_CONFIG_NOSYSTEM
81
82SetEnvIf Git-Protocol ".*" GIT_PROTOCOL=$0
83
84Alias /dumb/ www/
85Alias /auth/dumb/ www/auth/dumb/
86
87<LocationMatch /smart/>
88 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
89 SetEnv GIT_HTTP_EXPORT_ALL
90</LocationMatch>
91<LocationMatch /smart_noexport/>
92 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
93</LocationMatch>
94<LocationMatch /smart_custom_env/>
95 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
96 SetEnv GIT_HTTP_EXPORT_ALL
97 SetEnv GIT_COMMITTER_NAME "Custom User"
98 SetEnv GIT_COMMITTER_EMAIL custom@example.com
99</LocationMatch>
100<LocationMatch /smart_namespace/>
101 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
102 SetEnv GIT_HTTP_EXPORT_ALL
103 SetEnv GIT_NAMESPACE ns
104</LocationMatch>
105<LocationMatch /smart_cookies/>
106 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
107 SetEnv GIT_HTTP_EXPORT_ALL
108 Header set Set-Cookie name=value
109</LocationMatch>
110<LocationMatch /smart_headers/>
111 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
112 SetEnv GIT_HTTP_EXPORT_ALL
113</LocationMatch>
114<LocationMatch /one_time_sed/>
115 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
116 SetEnv GIT_HTTP_EXPORT_ALL
117</LocationMatch>
118ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
119ScriptAlias /broken_smart/ broken-smart-http.sh/
120ScriptAlias /error/ error.sh/
121ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1
122<Directory ${GIT_EXEC_PATH}>
123 Options FollowSymlinks
124</Directory>
125<Files broken-smart-http.sh>
126 Options ExecCGI
127</Files>
128<Files error.sh>
129 Options ExecCGI
130</Files>
131<Files apply-one-time-sed.sh>
132 Options ExecCGI
133</Files>
134<Files ${GIT_EXEC_PATH}/git-http-backend>
135 Options ExecCGI
136</Files>
137
138RewriteEngine on
139RewriteRule ^/dumb-redir/(.*)$ /dumb/$1 [R=301]
140RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301]
141RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302]
142RewriteRule ^/smart-redir-auth/(.*)$ /auth/smart/$1 [R=301]
143RewriteRule ^/smart-redir-limited/(.*)/info/refs$ /smart/$1/info/refs [R=301]
144RewriteRule ^/ftp-redir/(.*)$ ftp://localhost:1000/$1 [R=302]
145
146RewriteRule ^/loop-redir/x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-(.*) /$1 [R=302]
147RewriteRule ^/loop-redir/(.*)$ /loop-redir/x-$1 [R=302]
148
149# redir-to/502/x?y -> really-redir-to?path=502/x&qs=y which returns 502
150# redir-to/x?y -> really-redir-to?path=x&qs=y -> x?y
151RewriteCond %{QUERY_STRING} ^(.*)$
152RewriteRule ^/redir-to/(.*)$ /really-redir-to?path=$1&qs=%1 [R=302]
153RewriteCond %{QUERY_STRING} ^path=502/(.*)&qs=(.*)$
154RewriteRule ^/really-redir-to$ - [R=502,L]
155RewriteCond %{QUERY_STRING} ^path=(.*)&qs=(.*)$
156RewriteRule ^/really-redir-to$ /%1?%2 [R=302]
157
158# The first rule issues a client-side redirect to something
159# that _doesn't_ look like a git repo. The second rule is a
160# server-side rewrite, so that it turns out the odd-looking
161# thing _is_ a git repo. The "[PT]" tells Apache to match
162# the usual ScriptAlias rules for /smart.
163RewriteRule ^/insane-redir/(.*)$ /intern-redir/$1/foo [R=301]
164RewriteRule ^/intern-redir/(.*)/foo$ /smart/$1 [PT]
165
166# Serve info/refs internally without redirecting, but
167# issue a redirect for any object requests.
168RewriteRule ^/redir-objects/(.*/info/refs)$ /dumb/$1 [PT]
169RewriteRule ^/redir-objects/(.*/objects/.*)$ /dumb/$1 [R=301]
170
171# Apache 2.2 does not understand <RequireAll>, so we use RewriteCond.
172# And as RewriteCond does not allow testing for non-matches, we match
173# the desired case first (one has abra, two has cadabra), and let it
174# pass by marking the RewriteRule as [L], "last rule, do not process
175# any other matching RewriteRules after this"), and then have another
176# RewriteRule that matches all other cases and lets them fail via '[F]',
177# "fail the request".
178RewriteCond %{HTTP:x-magic-one} =abra
179RewriteCond %{HTTP:x-magic-two} =cadabra
180RewriteRule ^/smart_headers/.* - [L]
181RewriteRule ^/smart_headers/.* - [F]
182
183<IfDefine SSL>
184LoadModule ssl_module modules/mod_ssl.so
185
186SSLCertificateFile httpd.pem
187SSLCertificateKeyFile httpd.pem
188SSLRandomSeed startup file:/dev/urandom 512
189SSLRandomSeed connect file:/dev/urandom 512
190SSLSessionCache none
191SSLMutex file:ssl_mutex
192SSLEngine On
193</IfDefine>
194
195<Location /auth/>
196 AuthType Basic
197 AuthName "git-auth"
198 AuthUserFile passwd
199 Require valid-user
200</Location>
201
202<LocationMatch "^/auth-push/.*/git-receive-pack$">
203 AuthType Basic
204 AuthName "git-auth"
205 AuthUserFile passwd
206 Require valid-user
207</LocationMatch>
208
209<LocationMatch "^/auth-fetch/.*/git-upload-pack$">
210 AuthType Basic
211 AuthName "git-auth"
212 AuthUserFile passwd
213 Require valid-user
214</LocationMatch>
215
216RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
217RewriteCond %{REQUEST_URI} /git-receive-pack$
218RewriteRule ^/half-auth-complete/ - [E=AUTHREQUIRED:yes]
219
220<Location /half-auth-complete/>
221 Order Deny,Allow
222 Deny from env=AUTHREQUIRED
223
224 AuthType Basic
225 AuthName "Git Access"
226 AuthUserFile passwd
227 Require valid-user
228 Satisfy Any
229</Location>
230
231<IfDefine DAV>
232 LoadModule dav_module modules/mod_dav.so
233 LoadModule dav_fs_module modules/mod_dav_fs.so
234
235 DAVLockDB DAVLock
236 <Location /dumb/>
237 Dav on
238 </Location>
239 <Location /auth/dumb>
240 Dav on
241 </Location>
242</IfDefine>
243
244<IfDefine SVN>
245 LoadModule dav_svn_module modules/mod_dav_svn.so
246
247 <Location /${LIB_HTTPD_SVN}>
248 DAV svn
249 SVNPath "${LIB_HTTPD_SVNPATH}"
250 </Location>
251</IfDefine>