apache.conf 7.2 KB
Newer Older
1
ServerName dummy
2 3
PidFile httpd.pid
DocumentRoot www
4 5
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog access.log common
6
ErrorLog error.log
7 8 9
<IfModule !mod_log_config.c>
	LoadModule log_config_module modules/mod_log_config.so
</IfModule>
10 11 12
<IfModule !mod_alias.c>
	LoadModule alias_module modules/mod_alias.so
</IfModule>
S
Shawn O. Pearce 已提交
13 14 15 16 17 18
<IfModule !mod_cgi.c>
	LoadModule cgi_module modules/mod_cgi.so
</IfModule>
<IfModule !mod_env.c>
	LoadModule env_module modules/mod_env.so
</IfModule>
19 20 21
<IfModule !mod_rewrite.c>
	LoadModule rewrite_module modules/mod_rewrite.so
</IFModule>
22 23 24
<IfModule !mod_version.c>
	LoadModule version_module modules/mod_version.so
</IfModule>
25 26 27
<IfModule !mod_headers.c>
	LoadModule headers_module modules/mod_headers.so
</IfModule>
28 29 30
<IfModule !mod_setenvif.c>
	LoadModule setenvif_module modules/mod_setenvif.so
</IfModule>
31

32 33 34 35
<IfVersion < 2.4>
LockFile accept.lock
</IfVersion>

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
<IfVersion < 2.1>
<IfModule !mod_auth.c>
	LoadModule auth_module modules/mod_auth.so
</IfModule>
</IfVersion>

<IfVersion >= 2.1>
<IfModule !mod_auth_basic.c>
	LoadModule auth_basic_module modules/mod_auth_basic.so
</IfModule>
<IfModule !mod_authn_file.c>
	LoadModule authn_file_module modules/mod_authn_file.so
</IfModule>
<IfModule !mod_authz_user.c>
	LoadModule authz_user_module modules/mod_authz_user.so
</IfModule>
52 53 54
<IfModule !mod_authz_host.c>
	LoadModule authz_host_module modules/mod_authz_host.so
</IfModule>
55
</IfVersion>
56

57 58 59 60 61 62 63
<IfVersion >= 2.4>
<IfModule !mod_authn_core.c>
	LoadModule authn_core_module modules/mod_authn_core.so
</IfModule>
<IfModule !mod_authz_core.c>
	LoadModule authz_core_module modules/mod_authz_core.so
</IfModule>
64 65 66
<IfModule !mod_access_compat.c>
	LoadModule access_compat_module modules/mod_access_compat.so
</IfModule>
67 68 69
<IfModule !mod_mpm_prefork.c>
	LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
</IfModule>
M
Michael J Gruber 已提交
70 71 72
<IfModule !mod_unixd.c>
	LoadModule unixd_module modules/mod_unixd.so
</IfModule>
73 74
</IfVersion>

75 76
PassEnv GIT_VALGRIND
PassEnv GIT_VALGRIND_OPTIONS
77
PassEnv GNUPGHOME
J
Jeff King 已提交
78
PassEnv ASAN_OPTIONS
J
Jeff King 已提交
79
PassEnv GIT_TRACE
80
PassEnv GIT_CONFIG_NOSYSTEM
81
PassEnv GIT_TEST_SIDEBAND_ALL
82

83
SetEnvIf Git-Protocol ".*" GIT_PROTOCOL=$0
84

85
Alias /dumb/ www/
86
Alias /auth/dumb/ www/auth/dumb/
87

88
<LocationMatch /smart/>
S
Shawn O. Pearce 已提交
89
	SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
90
	SetEnv GIT_HTTP_EXPORT_ALL
91 92
</LocationMatch>
<LocationMatch /smart_noexport/>
93
	SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
94 95
</LocationMatch>
<LocationMatch /smart_custom_env/>
96 97 98 99
	SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
	SetEnv GIT_HTTP_EXPORT_ALL
	SetEnv GIT_COMMITTER_NAME "Custom User"
	SetEnv GIT_COMMITTER_EMAIL custom@example.com
100
</LocationMatch>
101 102 103 104 105
<LocationMatch /smart_namespace/>
	SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
	SetEnv GIT_HTTP_EXPORT_ALL
	SetEnv GIT_NAMESPACE ns
</LocationMatch>
106 107 108 109 110
<LocationMatch /smart_cookies/>
	SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
	SetEnv GIT_HTTP_EXPORT_ALL
	Header set Set-Cookie name=value
</LocationMatch>
111 112 113 114
<LocationMatch /smart_headers/>
	SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
	SetEnv GIT_HTTP_EXPORT_ALL
</LocationMatch>
115 116 117 118
<LocationMatch /one_time_sed/>
	SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
	SetEnv GIT_HTTP_EXPORT_ALL
</LocationMatch>
119
ScriptAliasMatch /error_git_upload_pack/(.*)/git-upload-pack error.sh/
120
ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
121
ScriptAlias /broken_smart/ broken-smart-http.sh/
122
ScriptAlias /error_smart/ error-smart-http.sh/
123
ScriptAlias /error/ error.sh/
124
ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1
S
Shawn O. Pearce 已提交
125
<Directory ${GIT_EXEC_PATH}>
126
	Options FollowSymlinks
S
Shawn O. Pearce 已提交
127
</Directory>
128 129 130
<Files broken-smart-http.sh>
	Options ExecCGI
</Files>
131 132 133
<Files error-smart-http.sh>
	Options ExecCGI
</Files>
134 135 136
<Files error.sh>
  Options ExecCGI
</Files>
137 138 139
<Files apply-one-time-sed.sh>
	Options ExecCGI
</Files>
S
Shawn O. Pearce 已提交
140 141 142 143
<Files ${GIT_EXEC_PATH}/git-http-backend>
	Options ExecCGI
</Files>

144
RewriteEngine on
J
Jeff King 已提交
145
RewriteRule ^/dumb-redir/(.*)$ /dumb/$1 [R=301]
146 147
RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301]
RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302]
148 149
RewriteRule ^/smart-redir-auth/(.*)$ /auth/smart/$1 [R=301]
RewriteRule ^/smart-redir-limited/(.*)/info/refs$ /smart/$1/info/refs [R=301]
150
RewriteRule ^/ftp-redir/(.*)$ ftp://localhost:1000/$1 [R=302]
151

B
Blake Burkhart 已提交
152 153 154
RewriteRule ^/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]
RewriteRule ^/loop-redir/(.*)$ /loop-redir/x-$1 [R=302]

155 156 157 158 159 160 161 162 163
# redir-to/502/x?y -> really-redir-to?path=502/x&qs=y which returns 502
# redir-to/x?y -> really-redir-to?path=x&qs=y -> x?y
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^/redir-to/(.*)$ /really-redir-to?path=$1&qs=%1 [R=302]
RewriteCond %{QUERY_STRING} ^path=502/(.*)&qs=(.*)$
RewriteRule ^/really-redir-to$ - [R=502,L]
RewriteCond %{QUERY_STRING} ^path=(.*)&qs=(.*)$
RewriteRule ^/really-redir-to$ /%1?%2 [R=302]

164 165 166 167 168 169 170 171
# The first rule issues a client-side redirect to something
# that _doesn't_ look like a git repo. The second rule is a
# server-side rewrite, so that it turns out the odd-looking
# thing _is_ a git repo. The "[PT]" tells Apache to match
# the usual ScriptAlias rules for /smart.
RewriteRule ^/insane-redir/(.*)$ /intern-redir/$1/foo [R=301]
RewriteRule ^/intern-redir/(.*)/foo$ /smart/$1 [PT]

J
Jeff King 已提交
172 173 174 175 176
# Serve info/refs internally without redirecting, but
# issue a redirect for any object requests.
RewriteRule ^/redir-objects/(.*/info/refs)$ /dumb/$1 [PT]
RewriteRule ^/redir-objects/(.*/objects/.*)$ /dumb/$1 [R=301]

177 178 179 180 181 182 183 184 185 186 187 188
# Apache 2.2 does not understand <RequireAll>, so we use RewriteCond.
# And as RewriteCond does not allow testing for non-matches, we match
# the desired case first (one has abra, two has cadabra), and let it
# pass by marking the RewriteRule as [L], "last rule, do not process
# any other matching RewriteRules after this"), and then have another
# RewriteRule that matches all other cases and lets them fail via '[F]',
# "fail the request".
RewriteCond %{HTTP:x-magic-one} =abra
RewriteCond %{HTTP:x-magic-two} =cadabra
RewriteRule ^/smart_headers/.* - [L]
RewriteRule ^/smart_headers/.* - [F]

189 190 191 192 193 194 195 196 197 198 199 200
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so

SSLCertificateFile httpd.pem
SSLCertificateKeyFile httpd.pem
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512
SSLSessionCache none
SSLMutex file:ssl_mutex
SSLEngine On
</IfDefine>

201 202 203 204 205 206 207
<Location /auth/>
	AuthType Basic
	AuthName "git-auth"
	AuthUserFile passwd
	Require valid-user
</Location>

208 209 210 211 212 213 214
<LocationMatch "^/auth-push/.*/git-receive-pack$">
	AuthType Basic
	AuthName "git-auth"
	AuthUserFile passwd
	Require valid-user
</LocationMatch>

215 216 217 218 219 220 221
<LocationMatch "^/auth-fetch/.*/git-upload-pack$">
	AuthType Basic
	AuthName "git-auth"
	AuthUserFile passwd
	Require valid-user
</LocationMatch>

222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
RewriteCond %{REQUEST_URI} /git-receive-pack$
RewriteRule ^/half-auth-complete/ - [E=AUTHREQUIRED:yes]

<Location /half-auth-complete/>
  Order Deny,Allow
  Deny from env=AUTHREQUIRED

  AuthType Basic
  AuthName "Git Access"
  AuthUserFile passwd
  Require valid-user
  Satisfy Any
</Location>

237 238 239 240 241
<IfDefine DAV>
	LoadModule dav_module modules/mod_dav.so
	LoadModule dav_fs_module modules/mod_dav_fs.so

	DAVLockDB DAVLock
242
	<Location /dumb/>
243 244
		Dav on
	</Location>
245 246 247
	<Location /auth/dumb>
		Dav on
	</Location>
248 249 250 251 252
</IfDefine>

<IfDefine SVN>
	LoadModule dav_svn_module modules/mod_dav_svn.so

253
	<Location /${LIB_HTTPD_SVN}>
254
		DAV svn
255
		SVNPath "${LIB_HTTPD_SVNPATH}"
256 257
	</Location>
</IfDefine>