aboutsummaryrefslogtreecommitdiffstats
path: root/config/httpd.conf
blob: 8a51fa2093d8b0ced7c26d4f4ad7d9af4765947a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Apache configuracreated_attion for FOI site.
#
# For development ignore this, you can just run ./scripts/server as for any
# Ruby on Rails application.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org
# 
# $Id: httpd.conf,v 1.25 2009-07-14 12:11:11 francis Exp $

# This is needed for the PHP spell checker
<Location /fcgi>
    Options +ExecCGI
    SetHandler fastcgi-script
</Location>

RewriteEngine On
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 9

# Make a file down.html in the DocumentRoot bring down the whole site and
# display itself.
#RewriteCond %{DOCUMENT_ROOT}/down.html -s
#RewriteRule /(.+).cgi /down.html [R]
#RewriteCond %{DOCUMENT_ROOT}/down.html !-s
#RewriteRule /down.html / [R]

# Pass through the HTTP basic authentication to mongrel. See also
# admin_http_auth_user in app/controllers/application.rb
# Note: Apache 2 only. Doesn't work in Apache 1.3, you'll need to live without
# it.
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule . - [E=RU:%1]
RequestHeader add X-Forwarded-User %{RU}e 

# Make a file down.html in the DocumentRoot bring down the whole site and
# display itself.
RewriteCond %{DOCUMENT_ROOT}/down.html -s
RewriteRule /([^.]*)$ /down.html [R]
RewriteCond %{DOCUMENT_ROOT}/down.html !-s
RewriteRule /down.html / [R]

# Use Mongrel as the main webserver (more reliable than FastCGI for Rails)
# RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
# RewriteRule ^/(.*) http://localhost:3000/$1 [P]

<Location /admin/balancer-manager>
    SetHandler balancer-manager
</Location> 

<Proxy balancer://foicluster>
# If adding new ones, launch extra mongrels in foimongreld.ugly also
BalancerMember http://localhost:3000
BalancerMember http://localhost:3001
BalancerMember http://localhost:3002
BalancerMember http://localhost:3003
BalancerMember http://localhost:3004
BalancerMember http://localhost:3005
BalancerMember http://localhost:3006
BalancerMember http://localhost:3007
BalancerMember http://localhost:3008
BalancerMember http://localhost:3009
BalancerMember http://localhost:3010
BalancerMember http://localhost:3011
BalancerMember http://localhost:3012
BalancerMember http://localhost:3013
BalancerMember http://localhost:3014
BalancerMember http://localhost:3015
# really should be lbmethod=bybusyness, but we don't have that algorithm yet.
# If it becomes a problem, upgrade or patch Apache with it. See:
# see http://labs.reevoo.com/2008/8/19/bybusy-mod-accepted-by-apache
ProxySet lbmethod=byrequests 
</Proxy>
ProxyPass /jslib !
ProxyPass /fcgi !
ProxyPass /files !
ProxyPass /down !
ProxyPass /down.html !
ProxyPass /admin/balancer-manager !
ProxyPass / balancer://foicluster/