migrate discovery source codes from OPEN-O
[msb/discovery.git] / nginx-ext-consul / src / assembly / resources / nginx / sites-enabled / openresty-consul.conf
diff --git a/nginx-ext-consul/src/assembly/resources/nginx/sites-enabled/openresty-consul.conf b/nginx-ext-consul/src/assembly/resources/nginx/sites-enabled/openresty-consul.conf
new file mode 100644 (file)
index 0000000..f4f19ab
--- /dev/null
@@ -0,0 +1,66 @@
+#set conf for proxy pass
+proxy_connect_timeout 15s;
+proxy_read_timeout 360s;
+proxy_send_timeout 120s;
+proxy_set_header X-Real-IP $remote_addr;
+proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+proxy_set_header Host $host:$server_port;
+proxy_http_version 1.1;
+proxy_set_header Connection "";
+
+upstream apibackend {
+    server 127.0.0.1:8076;
+       keepalive 200;
+}
+upstream consulbackend {
+    server 127.0.0.1:8500;
+       keepalive 200;
+}
+
+
+server {
+   listen 10081;
+   
+   location /api/microservices/v1 {
+               proxy_pass http://apibackend;
+   } 
+   location /iui/microservices {
+               root html ;
+   } 
+   
+   location /admin/metrics {
+               proxy_pass http://apibackend;
+   }
+   
+   location /api/msdiscover/v1 {
+        rewrite ^/api/msdiscover/v1/(.*) /api/microservices/v1/$1 break;
+               proxy_pass http://apibackend;
+   } 
+   
+   location /api/catalog/v1 {
+        rewrite ^/api/catalog/v1/(.*) /v1/catalog/$1 break;
+               proxy_pass http://consulbackend;
+   } 
+   
+   location /api/health/v1 {
+        rewrite ^/api/health/v1/(.*) /v1/health/$1 break;
+               proxy_pass http://consulbackend;
+   }
+
+   location /api/health_check/v1 {
+        rewrite /api/health_check/v1 /v1/status/leader break;
+        proxy_pass http://consulbackend;
+   }      
+
+   location = /favicon.ico {
+        log_not_found off;
+   }
+
+   location = /msb {
+      return 302 $scheme://$http_host/iui/microservices/index.html;
+   }   
+
+   location  / {                                                    
+      return 502 ;
+   } 
+}
\ No newline at end of file