root/swish_website/etc/httpd.conf.tt

Revision 1912, 9.6 kB (checked in by karpet, 1 year ago)

undo - Bill removed .htaccess files instead

Line 
1 [%
2
3     # Default config variables if not specified in the make_httpd command line.
4
5     DEFAULT domain          = 'swish-e.org';
6     DEFAULT module_dir      = 'modules';
7     DEFAULT user            = 'apache';
8     DEFAULT group           = 'apache';
9     DEFAULT logs            = 'logs';
10     DEFAULT pid_file        = 'run/httpd.pid';
11     DEFAULT ipaddr          = '*';
12     DEFAULT port            =  80;
13
14     DEFAULT trac_doc_root   = '/opt/trac/htdocs';
15     DEFAULT trac_env        = '/opt/trac';
16     DEFAULT trac_password   = '/opt/svn/swish/conf/dav_svn.passwd';
17
18     DEFAULT svn_repo        = '/opt/svn/swish';
19
20
21
22
23     # Template to generate httpd.conf file.
24
25     modules = [
26         'access'
27         'auth'
28         'log_config'
29         'env'
30         'expires'
31         'deflate'
32         'setenvif'
33         'mime'
34         'status'
35         'dir'
36         'alias'
37         'cgi'
38     ];
39
40     svn_modules = [
41         'dav'
42         'dav_svn'
43         'authz_svn'
44     ];
45
46     trac_modules = [
47         'python'
48     ];
49
50
51     host_port = "$ipaddr:$port";
52
53     USE format_module = format('%-20s');
54
55     MACRO server_name( site ) BLOCK;
56         "\n";
57
58         IF site;
59             "    ServerName     ${site}.$domain\n";
60             "    ErrorLog       $logs/${site}.error\n";
61             "    CustomLog      $logs/${site}.log combined\n";
62         ELSE;
63             "    ServerName     $domain\n";
64             "    ServerAlias    www.$domain\n";
65             "    ErrorLog       $logs/${domain}.error\n";
66             "    CustomLog      $logs/${domain}.log combined\n";
67         END;
68     END;
69
70
71     MACRO load_modules( modules ) BLOCK;
72         FOR module = modules;
73             mod_name = module _ '_module';
74             mod_path = "$module_dir/mod_${module}.so";
75
76
77             # This requires that the module directory is absolute
78             # but also makes the code Apache 2.2-aware.
79             TRY;
80                 USE File( mod_path );
81
82                 mod_name = format_module( mod_name );
83
84                 "<IFModule !${module}.c>\n";
85                 "    LoadModule $mod_name $mod_path\n";
86                 "</IFModule>\n";
87
88
89             CATCH;
90                 "Warning: module '$mod_path' was not found\n" | stderr;
91
92                 # Maybe apache2
93                 IF module == 'auth';
94                     load_modules( [ 'authz_user', 'authn_file' ] );
95
96                 ELSIF module == 'access';
97                     load_modules( [ 'authz_host' ] );
98                 END;
99             END;
100
101         END;
102     END;
103
104 %]
105
106
107 #-----------------------------------------------------------------------------
108 #
109 #  This is a generated configuration file -- do not edit directly.
110 #  Instead edit [% template.name %] and regenerate by running:
111 #     [% script %] [% arguments %]
112 #
113 #
114 #-----------------------------------------------------------------------------
115
116 PidFile [% pid_file %]
117 ErrorLog [% logs %]/error_log
118
119 Listen [% host_port %]
120
121 [% load_modules( modules ) %]
122
123 TypesConfig /etc/mime.types
124
125 User [% user %]
126 Group [% group %]
127
128
129 ServerAdmin webmaster@[% domain %]
130
131 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
132 CustomLog [% logs %]/access_log combined
133 ServerName [% domain %]
134
135
136 # Restrictive from start
137 <Directory />
138     Deny from all
139     Options none
140 </Directory>
141
142 NameVirtualHost [% host_port %]
143
144
145 #============================================================================
146 #                        Virtual Hosts
147 #============================================================================
148
149
150
151 #-----------------------------------------------------------------------#
152 #                  catch bad Host:                                      #
153 #-----------------------------------------------------------------------#
154 <VirtualHost [% host_port %]>
155     [% server_name( 'bad' ) %]
156
157     <Directory />
158         Deny from all
159     </Directory>
160 </VirtualHost>
161
162
163 [% IF web_site %]
164
165
166 #-----------------------------------------------------------------------#
167 #                  swish-e.com                                          #
168 #-----------------------------------------------------------------------#
169 <VirtualHost [% host_port %]>
170
171     ServerName  swish-e.com
172     ServerAlias www.swish-e.com
173
174     Redirect permanent / http://swish-e.org/
175 </VirtualHost>
176
177
178 #-----------------------------------------------------------------------#
179 #                  swish-e.org                                          #
180 #-----------------------------------------------------------------------#
181 <VirtualHost [% host_port %]>
182
183     [% server_name( '' ) %]
184
185     ServerAlias p3.[% domain %]
186
187
188     [% IF perl5lib %]
189     SetEnv PERL5LIB [% perl5lib %]
190     [% END %]
191
192     DocumentRoot [% dest %]
193
194     <Directory [% dest %]>
195         Options FollowSymLinks
196         Allow from all
197     </Directory>
198
199     [% IF download %]
200     Alias /distribution/ [% download %]/
201     <Directory [% download %]>
202         Options FollowSymLinks
203         Allow from all
204     </Directory>
205     [% END %]
206
207
208     [% IF daily %]
209     Alias /swish-daily/  [% daily %]/
210     <Directory [% daily %]>
211         Options FollowSymLinks
212         Allow from all
213     </Directory>
214     [% END %]
215
216
217     [% IF archive %]
218     Alias /archive/  [% archive %]/
219     <Directory [% archive %]>
220         Allow from all
221     </Directory>
222     [% END %]
223
224
225     ErrorDocument 404 /404.html
226     <Files 404.html>
227         Options +ExecCGI
228         SetHandler cgi-script
229     </Files>
230
231     <Directory [% dest %]/search>
232         <Files index.html>
233             Options +ExecCGI
234             SetHandler cgi-script
235         </Files>
236     </Directory>
237
238 </VirtualHost>
239 [% ELSE %]
240 # swish-e web site config not included
241 [% END; # /web_site %]
242
243
244 [% IF lists_site %]
245 #-----------------------------------------------------------------------#
246 #                  lists.swish-e.org                                    #
247 #-----------------------------------------------------------------------#
248 <VirtualHost [% host_port %]>
249
250     [% server_name( 'lists' ) %]
251
252
253     DocumentRoot /usr/lib/mailman/cgi-bin
254     <Directory /usr/lib/mailman/cgi-bin/>
255         AllowOverride None
256         Options ExecCGI
257         SetHandler cgi-script
258         Allow from all
259     </Directory>
260
261
262     Alias /pipermail/ /var/lib/mailman/archives/public/
263     <Directory /var/lib/mailman/archives/public>
264         Options Indexes MultiViews FollowSymLinks
265         AllowOverride None
266         Order allow,deny
267         Allow from all
268     </Directory>
269
270     Alias /icons/ /var/www/icons/
271     <Directory /var/www/icons>
272         Allow from all
273     </Directory>
274
275     # Uncomment the following line, replacing www.example.com with your server's
276     # name, to redirect queries to /mailman to the listinfo page (recommended).
277
278     # RedirectMatch ^/mailman[/]*$ http://www.example.com/mailman/listinfo
279
280
281
282 </VirtualHost>
283 [% ELSE %]
284 # lists website (mailman) not included
285 [% END; # /lists_site %]
286
287
288 [% IF dev_site %]
289 #-----------------------------------------------------------------------#
290 #                  dev.swish-e.org (trac)                               #
291 #-----------------------------------------------------------------------#
292 [% load_modules( trac_modules ) IF trac_modules %]
293 <VirtualHost [% host_port %]>
294
295     [% server_name( 'dev' ) %]
296
297     DocumentRoot [% trac_doc_root %]
298
299     Alias /static/ [% trac_doc_root %]/
300
301     <Location />
302         SetHandler mod_python
303         PythonHandler trac.web.modpython_frontend
304         PythonOption TracEnv [% trac_env %]
305         PythonOption TracUriRoot /
306     </Location>
307
308     <Location /login>
309         AuthName "Swish Development Area"
310         AuthType Basic
311         AuthUserFile [% trac_password %]
312         Require valid-user
313     </Location>
314
315     <Location /static/>
316         SetHandler none
317     </Location>
318
319     <Directory [% trac_doc_root%]>
320         Order allow,deny
321         Allow from all
322     </Directory>
323
324 </VirtualHost>
325 [% ELSE %]
326 # trac website not included
327 [% END; # /dev_site %]
328
329
330 [% IF svn_site %]
331 [% load_modules( svn_modules ) IF svn_modules %]
332 #-----------------------------------------------------------------------#
333 #                  svn.swish-e.org                                      #
334 #-----------------------------------------------------------------------#
335
336 <VirtualHost [% host_port %]>
337
338     [% server_name( 'svn' ) %]
339
340     <Location />
341         DAV svn
342         SVNPath [% svn_repo %]
343
344         Allow from all
345         AuthzSVNAccessFile [% svn_repo %]/conf/svn-auth-policy
346
347
348         # For any operations other than these, require an authenticated user.
349         <LimitExcept GET PROPFIND OPTIONS REPORT>
350             AuthType Basic
351             AuthName "Swish Subversion Repository"
352             AuthUserFile [% svn_repo %]/conf/dav_svn.passwd
353             Require valid-user
354         </LimitExcept>
355     </Location>
356
357 </VirtualHost>
358 [% ELSE %]
359 #  svn website not included
360 [% END; # /svn_site %]
361
362
363 #
364 # The following directives modify normal HTTP response behavior to
365 # handle known problems with browser implementations.
366 #
367 BrowserMatch "Mozilla/2" nokeepalive
368 BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
369 BrowserMatch "RealPlayer 4\.0" force-response-1.0
370 BrowserMatch "Java/1\.0" force-response-1.0
371 BrowserMatch "JDK/1\.0" force-response-1.0
372
373 #
374 # The following directive disables redirects on non-GET requests for
375 # a directory that does not include the trailing slash.  This fixes a+
376 # problem with Microsoft WebFolders which does not appropriately handle+
377 # redirects for folders with DAV methods.
378 # Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
379 #
380 BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
381 BrowserMatch "^WebDrive" redirect-carefully
382 BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
383 BrowserMatch "^gnome-vfs" redirect-carefully
384
385                                                            
386
387
388
389
390
391
392
393
394
395
396
397
398
Note: See TracBrowser for help on using the browser.