# nginx config example to receive data from alohalytics clients. http { log_format alohalytics '$remote_addr [$time_local] "$request" $status $content_length "$http_user_agent"'; # Default server which handles and ignores all invalid requests. server { listen 80 default_server; server_tokens off; return 444; access_log /var/log/nginx/default-access.log; error_log /var/log/nginx/default-error.log warn; } server { server_name aloha.with.you; server_tokens off; listen 80; listen 443 ssl; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv2 SSLv3; ssl_certificate /etc/nginx/ssl/aloha.with.you.crt; ssl_certificate_key /etc/nginx/ssl/aloha.with.you.key; # Config for the most recent client version. location ~ ^/(ios|android)/(.+)/(.+) { # Most filtering can be easily done on nginx side: # - Our clients send only POST requests. limit_except POST { deny all; } # - Content-Length should be valid, but it is checked anyway on FastCGI app's code side. # - Content-Type should be "application/alohalytics-binary-blob" if ($content_type != "application/alohalytics-binary-blob") { return 415; # Unsupported Media Type } # - Content-Encoding should be "gzip" if ($http_content_encoding != "gzip") { return 400; # Bad Request } client_body_buffer_size 1M; client_max_body_size 10M; access_log /var/log/nginx/alohalytics-access.log alohalytics; error_log /var/log/nginx/alohalytics-error.log warn; fastcgi_pass_request_headers on; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REQUEST_URI $request_uri; # Specify valid port for your fcgi_server instance. fastcgi_pass 127.0.0.1:8888; } } # End of http block.