]> git.openstreetmap.org Git - rails.git/blob - config/nginx.conf
745fa555ed9f71a7ca99215248af04789a23be3a
[rails.git] / config / nginx.conf
1 user www-data;\r
2 worker_processes  1;\r
3 \r
4 error_log  /var/log/nginx/error.log;\r
5 pid        /var/run/nginx.pid;\r
6 \r
7 events {\r
8     worker_connections  1024;\r
9 }\r
10 \r
11 http {\r
12     include       /etc/nginx/mime.types;\r
13     default_type  application/octet-stream;\r
14 \r
15     #access_log  /var/log/nginx/access.log;\r
16 \r
17     sendfile        on;\r
18     #tcp_nopush     on;\r
19 \r
20     #keepalive_timeout  0;\r
21     keepalive_timeout  65;\r
22     tcp_nodelay        on;\r
23 \r
24     gzip  on;\r
25         gzip_min_length 1100;\r
26         gzip_buffers 4 8k;\r
27         # text/html is added gzip_types by default\r
28         gzip_types text/plain application/x-javascript application/x-shockwave-flash text/css;\r
29         #NO CGI SUPPORT IN NGINX fix stat .pl later\r
30 \r
31         upstream web_backend {\r
32                 server 127.0.0.1:8000;\r
33                 server 127.0.0.1:8001;\r
34                 server 127.0.0.1:8002;\r
35                 server 127.0.0.1:8003;\r
36                 server 127.0.0.1:8004;\r
37                 server 127.0.0.1:8005;\r
38                 server 127.0.0.1:8006;\r
39                 server 127.0.0.1:8007;\r
40                 server 127.0.0.1:8008;\r
41                 server 127.0.0.1:8009;\r
42                 server 127.0.0.1:8010;\r
43                 server 127.0.0.1:8011;\r
44                 server 127.0.0.1:8012;\r
45                 server 127.0.0.1:8013;\r
46                 server 127.0.0.1:8014;\r
47                 server 127.0.0.1:8015;\r
48                 server 127.0.0.1:8016;\r
49                 server 127.0.0.1:8017;\r
50                 server 127.0.0.1:8018;\r
51                 server 127.0.0.1:8019;\r
52                 server 127.0.0.1:8020;\r
53                 server 127.0.0.1:8021;\r
54                 server 127.0.0.1:8022;\r
55                 server 127.0.0.1:8023;\r
56                 server 127.0.0.1:8024;\r
57                 server 127.0.0.1:8025;\r
58                 server 127.0.0.1:8026;\r
59                 server 127.0.0.1:8027;\r
60                 server 127.0.0.1:8028;\r
61                 server 127.0.0.1:8029;\r
62         }\r
63 \r
64         upstream api_backend {\r
65                 server 127.0.0.1:8030;\r
66                 server 127.0.0.1:8031;\r
67                 server 127.0.0.1:8032;\r
68                 server 127.0.0.1:8033;\r
69                 server 127.0.0.1:8034;\r
70                 server 127.0.0.1:8035;\r
71                 server 127.0.0.1:8036;\r
72                 server 127.0.0.1:8037;\r
73                 server 127.0.0.1:8038;\r
74                 server 127.0.0.1:8039;\r
75                 server 127.0.0.1:8040;\r
76                 server 127.0.0.1:8041;\r
77                 server 127.0.0.1:8042;\r
78                 server 127.0.0.1:8043;\r
79                 server 127.0.0.1:8044;\r
80         }\r
81 \r
82         upstream bulkapi_backend {\r
83                 server 10.0.0.10:8000;\r
84                 server 10.0.0.11:8000;\r
85                 server 10.0.0.12:8000;\r
86                 server 10.0.0.10:8001;\r
87                 server 10.0.0.11:8001;\r
88                 server 10.0.0.12:8001;\r
89                 server 10.0.0.10:8002;\r
90                 server 10.0.0.11:8002;\r
91                 server 10.0.0.12:8002;\r
92                 server 10.0.0.10:8003;\r
93                 server 10.0.0.11:8003;\r
94                 server 10.0.0.12:8003;\r
95         }\r
96         \r
97         upstream tah_backend {\r
98                 server 10.0.0.10:8004;\r
99                 server 10.0.0.11:8004;\r
100                 server 10.0.0.12:8004;\r
101                 server 10.0.0.10:8005;\r
102                 server 10.0.0.11:8005;\r
103                 server 10.0.0.12:8005;\r
104         }\r
105 \r
106         server {\r
107                 listen   80;\r
108                 server_name  .openstreetmap.org api.openstreetmap.org;\r
109                 root /home/rails/public;\r
110                 index index.html;\r
111                 access_log  /var/log/nginx/openstreetmap.org.access.log;\r
112 \r
113                 if ($host ~* api\.(.*)) {\r
114                         rewrite ^/(0\.[0-9]+)/(.*)$ /api/$1/$2\r
115                 }\r
116 \r
117                 location / {\r
118                         deny 143.210.16.160;\r
119                         allow all; \r
120                 }\r
121 \r
122                 location /trac/ {\r
123                         rewrite ^/trac/(.*)$ http://trac.openstreetmap.org/$1 permanent;\r
124                 }\r
125 \r
126                 location /wiki/ {\r
127                         rewrite ^/wiki/(.*)$ http://wiki.openstreetmap.org/$1 permanent;\r
128                 }\r
129                 \r
130                 location /api/ {\r
131                         include /etc/nginx/fastcgi_params;\r
132                         if ($http_user_agent = "tilesAtHome") {\r
133                                 fastcgi_pass tah_backend;\r
134                                 break;\r
135                         }\r
136                 }\r
137 \r
138                 location ~ ^/api/0\.6/(map|trackpoints|amf|amf/read|swf/trackpoints)$ {\r
139                         include /etc/nginx/fastcgi_params;\r
140                         fastcgi_pass bulkapi_backend;\r
141                         break;\r
142                 }\r
143                 \r
144                 location ~ ^/api/0\.6/.*/search$ {\r
145                         include /etc/nginx/fastcgi_params;\r
146                         fastcgi_pass bulkapi_backend;\r
147                         break;\r
148                 }\r
149 \r
150                 location ~ ^/api/0\.6/ {\r
151                         include /etc/nginx/fastcgi_params;\r
152                         fastcgi_pass api_backend;\r
153                         break;\r
154                 }\r
155 \r
156                 location ~ ^/api/0\.[0-9]+/ {\r
157                         deny all;\r
158                 }\r
159         \r
160                 location / {\r
161                         include /etc/nginx/fastcgi_params;\r
162                         if (!-f $request_filename) {\r
163                                 fastcgi_pass web_backend;\r
164                                 break;\r
165                         }\r
166                 }\r
167 \r
168                 location /crossdomain.xml {\r
169                         default_type text/x-cross-domain-policy;\r
170                 }\r
171 \r
172                 #error_page  404  /404.html;\r
173                 # redirect server error pages to the static page /50x.html\r
174                 error_page   500 502 503 504  /50x.html;\r
175                 location = /50x.html {\r
176                         root   /var/www/nginx-default;\r
177                 }\r
178         }\r
179 }\r
180 \r