user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; log_format main '[$time_local] $status REQUEST: "$request" REFERER: "$http_referer" FWD_FOR "$http_x_forwarded_for" PROXY_HOST: "$proxy_host" UPSTREAM_ADDR: "$upstream_addr"'; gzip on; server { server_name cartodb.localhost *.cartodb.localhost; client_max_body_size 0; location ~* /(user/.*/)?api/v1/maps { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:3000; } location ~* /(user/.*/)?api/v1/map { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Carto-Service windshaft; # tell varnish what backend proxy_no_cache true; # Make sure nginx doesn't cache proxy_cache_bypass true; # Make sure nginx doesn't cache proxy_pass http://127.0.0.1:6081; # hand off to Varnish } location ~* /(user/.*/)?api/v2/sql { # RedHog: Hack to work around bug in cartodb local hosting but using cdn for js libs rewrite /(user/.*)?/api/v2/sql(.*) /$1/api/v2/sql$2 break; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Carto-Service sqlapi; # tell varnish what backend proxy_no_cache true; # make sure nginx doesn't cache proxy_cache_bypass true; # make sure nginx doesn't cache proxy_pass http://127.0.0.1:6081; # hand off to Varnish } location ^~ /assets { root /cartodb/public; } location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:3000; } error_log /var/log/nginx/cartodb_error.log; access_log /var/log/nginx/cartodb_access.log main; } }