correct nginx syntax
[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                 location / {\r
114                         deny 143.210.16.160;\r
115                         allow all; \r
116                 }\r
117 \r
118                 location /trac/ {\r
119                         rewrite ^/trac/(.*)$ http://trac.openstreetmap.org/$1 permanent;\r
120                 }\r
121                 location /wiki/ {\r
122                         rewrite ^/wiki/(.*)$ http://wiki.openstreetmap.org/$1 permanent;\r
123                 }\r
124                 \r
125                 location /api/ {\r
126                         include /etc/nginx/fastcgi_params;\r
127                         if ($http_user_agent = "tilesAtHome") {\r
128                                 fastcgi_pass tah_backend;\r
129                                 break;\r
130                         }\r
131                 }\r
132 \r
133                 location ~ ^/api/0\.6/(map|trackpoints|amf|amf/read|swf/trackpoints)$ {\r
134                         include /etc/nginx/fastcgi_params;\r
135                         fastcgi_pass bulkapi_backend;\r
136                         break;\r
137                 }\r
138                 \r
139                 location ~ ^/api/0\.6/.*/search$ {\r
140                         include /etc/nginx/fastcgi_params;\r
141                         fastcgi_pass bulkapi_backend;\r
142                         break;\r
143                 }\r
144 \r
145                 location ~ ^/api/0\.6/ {\r
146                         include /etc/nginx/fastcgi_params;\r
147                         fastcgi_pass api_backend;\r
148                         break;\r
149                 }\r
150 \r
151                 location ~ ^/api/0\.[0-9]+/ {\r
152                         deny all;\r
153                 }\r
154         \r
155                 location / {\r
156                         include /etc/nginx/fastcgi_params;\r
157                         if (!-f $request_filename) {\r
158                                 fastcgi_pass web_backend;\r
159                                 break;\r
160                         }\r
161                 }\r
162 \r
163                 location /crossdomain.xml {\r
164                         default_type text/x-cross-domain-policy;\r
165                 }\r
166 \r
167                 #error_page  404  /404.html;\r
168                 # redirect server error pages to the static page /50x.html\r
169                 error_page   500 502 503 504  /50x.html;\r
170                 location = /50x.html {\r
171                         root   /var/www/nginx-default;\r
172                 }\r
173         }\r
174 }\r
175 \r