Created
April 22, 2019 09:33
-
-
Save chowdhary987/ea043916a63e4ce375f4801a8a154fad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user www-data; | |
| worker_processes auto; | |
| worker_rlimit_nofile 10000; | |
| events { | |
| multi_accept on; | |
| worker_connections 10000; | |
| } | |
| http { | |
| include mime.types; | |
| default_type application/octet-stream; | |
| proxy_http_version 1.1; | |
| proxy_set_header Connection ""; | |
| sendfile on; | |
| tcp_nodelay on; | |
| tcp_nopush on; | |
| open_file_cache max=200000 inactive=20s; | |
| open_file_cache_valid 30s; | |
| open_file_cache_min_uses 2; | |
| open_file_cache_errors on; | |
| keepalive_timeout 65; | |
| keepalive_requests 300; | |
| gzip on; | |
| gzip_disable "msie6"; | |
| gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript; | |
| server_names_hash_bucket_size 128; | |
| access_log /var/log/nginx/access.log; | |
| error_log /var/log/nginx/error.log; | |
| log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $status / upstream $upstream_status $request upstream_response_time $upstream_response_time msec $msec request_time $request_time'; | |
| access_log /var/log/nginx/access.log upstreamlog; | |
| resolver 10.0.2.3; | |
| upstream deviceoauth { | |
| keepalive 32; | |
| server device_oauth-globald-useast1.smartthingsgdev.com:443 resolve; | |
| server device_oauth-globald-euwest1.smartthingsgdev.com:443 backup resolve; | |
| server 10.0.2.2:8090 backup resolve; | |
| } | |
| upstream datamgmt { | |
| keepalive 32; | |
| server 192.168.111.1:8080 ; | |
| } | |
| upstream hub { | |
| keepalive 32; | |
| server 192.168.111.1:8199; | |
| } | |
| upstream elder { | |
| keepalive 300; | |
| server 192.168.111.1:8209; | |
| } | |
| upstream executableapi { | |
| keepalive 32; | |
| server executableapi-globald-useast1.smartthingsgdev.com:443 resolve; | |
| server executableapi-globald-euwest1.smartthingsgdev.com:443 backup resolve; | |
| } | |
| upstream platformapi { | |
| keepalive 300; | |
| server 192.168.111.1:8140 ; | |
| } | |
| upstream informant { | |
| keepalive 32; | |
| server informant-globald-useast1.smartthingsgdev.com:443 resolve; | |
| server informant-globald-euwest1.smartthingsgdev.com:443 backup resolve; | |
| } | |
| upstream hawker { | |
| keepalive 32; | |
| server hawker-globald-useast1.smartthingsgdev.com:443 resolve; | |
| server hawker-globald-euwest1.smartthingsgdev.com:443 backup resolve; | |
| } | |
| # rate limiting zone | |
| limit_req_zone $binary_remote_addr zone=proxy:10m rate=1r/s; | |
| # don't include server port when issuing redirects | |
| port_in_redirect off; | |
| # don't show Nginx version in error pages and server header | |
| server_tokens off; | |
| server { | |
| listen 127.0.0.1; | |
| location / { | |
| access_log off; | |
| allow 127.0.0.1; | |
| deny all; | |
| stub_status on; | |
| } | |
| } | |
| server { | |
| listen 8101; | |
| return 301 https://$host$request_uri; | |
| } | |
| server { | |
| listen 8888; | |
| server_name localhost; | |
| access_log off; | |
| allow 127.0.0.1; | |
| deny all; | |
| location /nginx_status { | |
| stub_status on; | |
| } | |
| } | |
| server { | |
| listen 8100; | |
| proxy_connect_timeout 5s; | |
| proxy_read_timeout 5s; | |
| # return 404 by default | |
| location / { | |
| return 404; | |
| } | |
| location = /ping { | |
| return 204; | |
| } | |
| location = /buildinfo { | |
| alias /opt/api_gateway/buildinfo.json; | |
| add_header Content-Type application/json; | |
| } | |
| location = /buildinfo/hub { | |
| proxy_pass http://hub/buildinfo; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| location /hubs/ { | |
| proxy_pass http://hub$request_uri; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| location /hub-reports/ { | |
| proxy_pass http://hub$request_uri; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| location = /tv/accelerator/videos { | |
| set $s3_bucket_endpoint "smartthings-vdtv.s3.amazonaws.com"; | |
| set $s3_bucket_path "api_gateway_accelerator"; | |
| set $loggedin "loggedout"; | |
| set $extend "noextend"; | |
| if ($http_authorization) { | |
| # for the short term, if you send us an auth header, we'll send you different videos | |
| set $loggedin "loggedin"; | |
| } | |
| if ($arg_includes ~ "extend") { | |
| set $extend "extend"; | |
| } | |
| # Set cache expiration to 7 days | |
| expires 7d; | |
| add_header Pragma public; | |
| add_header Cache-Control "public"; | |
| # S3 bucket proxying, see https://coderwall.com/p/rlguog/nginx-as-proxy-for-amazon-s3-public-private-files | |
| proxy_http_version 1.1; | |
| proxy_set_header Host $s3_bucket_endpoint; | |
| proxy_set_header Authorization ''; | |
| proxy_hide_header x-amz-id-2; | |
| proxy_hide_header x-amz-request-id; | |
| proxy_hide_header Set-Cookie; | |
| proxy_ignore_headers "Set-Cookie"; | |
| proxy_buffering off; | |
| proxy_pass http://${s3_bucket_endpoint}/${s3_bucket_path}/${loggedin}_${extend}.json; | |
| } | |
| # device oauth proxy | |
| location /tv/ { | |
| proxy_pass https://deviceoauth$request_uri; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| location /deviceoauth/ { | |
| proxy_pass https://deviceoauth/hub/; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| # Shop redirect | |
| location = /shop/offer/extend { | |
| return 302 https://shop.smartthings.com/#!/tv-extend-early-access; | |
| } | |
| # Shop JWT token | |
| location = /auth/tokenAuth { | |
| proxy_pass http://datamgmt/login/tokenAuth; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| # executable api proxy | |
| location = /buildinfo/executables { | |
| proxy_pass https://executableapi/buildinfo; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| location /executables { | |
| proxy_pass https://executableapi$request_uri; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| include /etc/nginx/snippets/cors.conf; | |
| } | |
| location /notifications { | |
| proxy_pass https://informant$request_uri; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| include /etc/nginx/snippets/cors.conf; | |
| } | |
| # platform api proxy | |
| location = /buildinfo/platform { | |
| proxy_pass http://platformapi/buildinfo; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| location /elder { | |
| proxy_pass http://elder$request_uri; | |
| proxy_read_timeout 10s; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| client_max_body_size 10M; | |
| include /etc/nginx/snippets/cors.conf; | |
| } | |
| location /locations { | |
| proxy_pass http://platformapi$request_uri; | |
| proxy_read_timeout 10s; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| include /etc/nginx/snippets/cors.conf; | |
| } | |
| location /devices { | |
| proxy_pass http://platformapi$request_uri; | |
| proxy_read_timeout 10s; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| include /etc/nginx/snippets/cors.conf; | |
| } | |
| location /installedapps { | |
| proxy_pass http://platformapi$request_uri; | |
| proxy_read_timeout 10s; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| include /etc/nginx/snippets/cors.conf; | |
| } | |
| location /countries { | |
| proxy_pass http://platformapi$request_uri; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| include /etc/nginx/snippets/cors.conf; | |
| } | |
| location /catalogs { | |
| proxy_pass https://hawker$request_uri; | |
| proxy_read_timeout 3s; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| } | |
| include /etc/nginx/conf.d/*.conf; | |
| include /etc/nginx/sites-enabled/*; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment