]> git.openstreetmap.org Git - chef.git/blob - cookbooks/web/templates/default/apache.backend.erb
Revert "Send diff uploads to cgimap"
[chef.git] / cookbooks / web / templates / default / apache.backend.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <VirtualHost *:443>
4   #
5   # Basic server configuration
6   #
7   ServerName <%= node[:fqdn] %>
8   ServerAlias api.openstreetmap.org www.openstreetmap.org
9   ServerAdmin webmaster@openstreetmap.org
10
11   #
12   # Enable SSL
13   #
14   SSLEngine on
15   SSLCertificateFile /etc/ssl/certs/www.openstreetmap.org.pem
16   SSLCertificateKeyFile /etc/ssl/private/www.openstreetmap.org.key
17
18   #
19   # Setup logging
20   #
21   LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %Dus %{UNIQUE_ID}e %{SSL_PROTOCOL}x %{SSL_CIPHER}x" combined_with_time
22   CustomLog /var/log/apache2/access.log combined_with_time
23   ErrorLog /var/log/apache2/error.log
24
25   #
26   # Turn on the rewrite engine
27   #
28   RewriteEngine on
29
30   #
31   # Recover the unique ID from the request headers
32   #
33   SetEnvIf X-Request-Id ^(.*)$ UNIQUE_ID=$1
34
35   #
36   # Configure rails
37   #
38   DocumentRoot <%= node[:web][:base_directory] %>/rails/public
39   RailsEnv production
40   PassengerMinInstances 3
41   PassengerMaxRequests 500
42   PassengerPreStart https://www.openstreetmap.org/
43   PassengerAppGroupName rails
44   SetEnv OPENSTREETMAP_STATUS <%= @status %>
45   SetEnv SECRET_KEY_BASE <%= @secret_key_base %>
46
47   #
48   # Get the real remote IP for requests via a trusted proxy
49   #
50   RemoteIPHeader X-Forwarded-For
51   RemoteIPTrustedProxy 10.0.32.0/24
52   RemoteIPTrustedProxy 10.0.48.0/24
53
54   #
55   # Pass authentication related headers to cgimap
56   #
57   <Location />
58     CGIPassAuth On
59   </Location>
60
61   #
62   # Pass supported calls to cgimap
63   #
64   RewriteRule ^/api/0\.6/map$ fcgi://127.0.0.1:8000$0 [P]
65   RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
66   RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+$ fcgi://127.0.0.1:8000$0 [P]
67   RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history$ fcgi://127.0.0.1:8000$0 [P]
68   RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full$ fcgi://127.0.0.1:8000$0 [P]
69   RewriteRule ^/api/0\.6/(nodes|ways|relations)$ fcgi://127.0.0.1:8000$0 [P]
70   RewriteRule ^/api/0\.6/changeset/[0-9]+/download$ fcgi://127.0.0.1:8000$0 [P]
71 </VirtualHost>
72
73 <Directory <%= node[:web][:base_directory] %>/rails/public>
74   Require all granted
75 </Directory>