Ticket #104: nginx.conf

File nginx.conf, 8.0 KB (added by scott.conger@…, 15 years ago)

Main configuration file (GET requests sent to /charon/adrequest)

Line 
1#
2# This configuration is written for nginx built in a special way, when all
3# directories which are not absolute are relative to THE CURRENT DIRECTORY.
4# Therefore, it is important where you are when you are launching nginx.
5# This config assumes you stand in the root of adserver deployment directory.
6#
7
8# User to run workers as. Notice all access is performed by workers.
9
10user webuser;
11
12# Number of worker proceses.
13
14worker_processes 4;
15
16# Error log, shared by all
17
18error_log logs/nginx.error.log;
19
20# File where nginx writes its process ID when it starts
21# This file is deleted by nginx if nginx shut down gracefully
22
23pid logs/nginx.pid;
24
25# number of simultaneous connections
26
27events {
28 worker_connections 8192;
29}
30
31http {
32
33 log_format main '$remote_addr $http_x_forwarded_for - $remote_user [$time_local] '
34 '"$request" $status $body_bytes_sent '
35 '"$http_referer" "$http_user_agent"';
36
37 # unlike default build, this is for nginx which takes all locations
38 # as relative to the CURRENT DIRECTORY, UNLESS the location is absolute.
39 # Therefore we shall specify config/mime.types.
40 # All the same applies to "access_log", "root" and other directives
41 # below if they specify locations in the filesystem (not Web locations).
42
43 include conf/nginx.mime.types;
44
45 default_type application/octet-stream;
46
47 access_log logs/nginx.access.log main;
48
49 # place temporary directories nginx wants
50 proxy_temp_path webdata/temp/proxy;
51 fastcgi_temp_path webdata/temp/fastcgi;
52 client_body_temp_path webdata/temp/client_body;
53
54 ############ FASTCGI TUNING PARAMS #####################
55 fastcgi_connect_timeout 60;
56 fastcgi_send_timeout 180;
57 fastcgi_read_timeout 180;
58 fastcgi_buffer_size 128k;
59 fastcgi_buffers 4 256k;
60 fastcgi_busy_buffers_size 256k;
61 fastcgi_temp_file_write_size 256k;
62 fastcgi_intercept_errors on;
63
64 # some tuning
65 sendfile on;
66 tcp_nopush on;
67 tcp_nodelay on;
68 gzip off;
69
70 # this prevents server version to be reported in headers and other places
71 server_tokens off;
72
73 keepalive_timeout 0;
74
75 upstream backend {
76 server 127.0.0.1:10000;
77 keepalive 5;
78 }
79
80 # define fastcgi backed via cluster even if one
81 # process
82
83 #============================================================
84
85 server {
86
87 listen 10001;
88 server_name main;
89 root webdata/root;
90
91 # generic setup of nginx on this port
92
93 location / {
94
95 index index.html index.htm;
96
97 limit_except GET {
98 deny all;
99 }
100 }
101
102 error_page 404 /404.html;
103
104 error_page 500 502 503 504 /50x.html;
105 location = /50x.html {
106 root webdata/root;
107 }
108
109 # internal hidden directory used by beacons
110 # this is not accessible by users, only via
111 # internal redirects done by fastcgi adserver
112
113 location /i/ {
114 internal;
115 alias webdata/hidden/;
116 }
117
118 # internal redirect for static page
119
120 location = /status.html {
121 limit_except GET {
122 deny all;
123 }
124 include conf/fastcgi_common.conf;
125 fastcgi_param BRANDNET_INTERNAL /i/checkstatus.html;
126 fastcgi_pass localhost:10000;
127 }
128
129 #
130 # This sets up beacon serving from root
131 # location via /1x1.gif
132 #
133
134 location = /1x1.gif {
135 limit_except GET {
136 deny all;
137 }
138 include conf/fastcgi_common.conf;
139 include conf/fastcgi_beacon.conf;
140 #fastcgi_pass localhost:10000;
141 fastcgi_pass backend;
142 fastcgi_keep_conn on;
143 }
144
145 #
146 # This is for a 20k image that Yahoo! wants for 3rd-party ad certification
147 #
148
149 location = /adc_buzzed_drinks_300x250.jpg {
150 limit_except GET {
151 deny all;
152 }
153 }
154
155 #
156 # The path sends a "OPT OUT" command to adserver.
157 # Adserver will then create a cookie that tells the
158 # adserver not to store any user data for subsequent
159 # requests.
160 #
161
162 location = /optout {
163 limit_except GET {
164 deny all;
165 }
166 include conf/fastcgi_common.conf;
167 fastcgi_param BRANDNET_OPTOUT true;
168 fastcgi_pass localhost:10000;
169 }
170
171
172 #
173 # This sets up beacon serving from another logical
174 # location "/b/1x1.gif", you can add any other
175 # locations like shown below, it does not require
176 # any modifications to the adserver
177 #
178
179 location = /b/1x1.gif {
180 limit_except GET {
181 deny all;
182 }
183 include conf/fastcgi_common.conf;
184 include conf/fastcgi_beacon.conf;
185 fastcgi_pass localhost:10000;
186 }
187
188 #
189 # Defines location from which ad redirects happen.
190 #
191
192 location = /charon/adrequest {
193 limit_except GET {
194 deny all;
195 }
196 include conf/fastcgi_common.conf;
197 #fastcgi_pass localhost:10000;
198 fastcgi_pass backend;
199 fastcgi_keep_conn on;
200 }
201
202 #
203 # Defines location from which our ad script is served.
204 #
205
206 location = /scripts/ads.js {
207 limit_except GET {
208 deny all;
209 }
210 include conf/fastcgi_common.conf;
211 fastcgi_param BRANDNET_SCRIPT true;
212 fastcgi_pass localhost:10000;
213 }
214
215 #
216 # Real-time bidder location
217 # - AdX is /r/gbid,
218 # - others could be /r/foo, etc.
219 #
220
221 location ^~ /r {
222 include conf/fastcgi_common.conf;
223 fastcgi_pass localhost:10000;
224 }
225
226 # Appnexus configuration
227 # - ready is just to let appnexus know we're ready.
228 # - bid is for bid requests
229 # - notify is for notify requests
230
231 location = /ready {
232 limit_except GET {
233 deny all;
234 }
235 include conf/fastcgi_common.conf;
236 fastcgi_param BRANDNET_APN_READY true;
237 fastcgi_pass localhost:10000;
238 }
239
240 location = /bid {
241 include conf/fastcgi_common.conf;
242 fastcgi_param BRANDNET_APN_BID true;
243 fastcgi_pass localhost:10000;
244 }
245
246 location = /notify {
247 include conf/fastcgi_common.conf;
248 fastcgi_param BRANDNET_APN_NOTIFY true;
249 fastcgi_pass localhost:10000;
250 }
251
252 location = /dp/get_cat {
253 include conf/fastcgi_common.conf;
254 fastcgi_param BRANDNET_APN_DATA true;
255 fastcgi_pass localhost:10000;
256 }
257
258 # Adap.tv configuration
259 # - adptvbid is for bid requests
260
261 location = /atvbid {
262 include conf/fastcgi_common.conf;
263 fastcgi_param BRANDNET_ADAPTV_BID true;
264 fastcgi_pass localhost:10000;
265 }
266
267 #
268 # This is just for Exelate right now
269 #
270 location = /s2s {
271 include conf/fastcgi_common.conf;
272 fastcgi_param BRANDNET_EXELATE_PIXEL true;
273 fastcgi_pass localhost:10000;
274 }
275
276
277 #
278 # another ad serving location, just as a demo but it
279 # can be used -- because adserver is not aware of all
280 # this (i.e. not aware of logical location), so you
281 # create any number of any logical locations as shown below
282 #
283
284 location = /a {
285 limit_except GET {
286 deny all;
287 }
288 include conf/fastcgi_common.conf;
289 fastcgi_pass localhost:10000;
290 }
291 }
292
293}