diff options
author | 2016-08-25 10:17:35 +0800 | |
---|---|---|
committer | 2016-08-25 10:24:54 +0800 | |
commit | 8597cf5e116012c038e83f763a816ca106cad4d2 (patch) | |
tree | 4f6671079047db1f565060dcce4bf2607856cf68 /msb-core/openresty-ext/src/assembly/resources/openresty/nginx/conf/nginx.conf | |
parent | eb9df7aa9e268192dd68a46af4576671b17adcf9 (diff) |
Solve api gateway issue
Change-Id: I88fedc04faaf4d799b9dbf4c306aa073cabd6218
Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
Diffstat (limited to 'msb-core/openresty-ext/src/assembly/resources/openresty/nginx/conf/nginx.conf')
-rw-r--r-- | msb-core/openresty-ext/src/assembly/resources/openresty/nginx/conf/nginx.conf | 256 |
1 files changed, 213 insertions, 43 deletions
diff --git a/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/conf/nginx.conf b/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/conf/nginx.conf index 5c524fc..9a2db3f 100644 --- a/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/conf/nginx.conf +++ b/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/conf/nginx.conf @@ -1,57 +1,227 @@ -# -# Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#user nobody; -worker_processes auto; -worker_rlimit_nofile 50000; - -error_log logs/error.log warn; -pid logs/nginx.pid; +#user xfs xfs; +worker_processes 1; + +error_log logs/error.log warn; +pid logs/nginx.pid; events { - #linux下打开提高性能 - #use epoll; - worker_connections 2048; - multi_accept on; + worker_connections 1024; } http { - server_tokens off; - include mime.types; - default_type text/html; + include mime.types; + + upstream iui { + server 127.0.0.1:8202; + } + + upstream nsoc { + server 127.0.0.1:8203; + } + + upstream roc { + server 127.0.0.1:8204; + } - #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - # '$status $body_bytes_sent "$http_referer" ' - # '"$http_user_agent" "$http_x_forwarded_for"'; + upstream umc { + server 127.0.0.1:8205; + } - #access_log logs/access.log main; - access_log off; + upstream ssh { + server 127.0.0.1:8209; + } - sendfile on; - tcp_nopush on; + upstream yamlparser { + server 127.0.0.1:8210; + } + + upstream dac { + server 127.0.0.1:8206; + } + + upstream cmcc { + server 127.0.0.1:8207; + } + + upstream tacker { + server 127.0.0.1:8208; + } + + upstream winery { + server 127.0.0.1:8080; + } + + upstream etsi { + server 127.0.0.1:8211; + } + + upstream openstackadapter { + server 127.0.0.1:8217; + } + + upstream vimadapter { + server 127.0.0.1:8218; + } + + upstream odlsdn { + server 127.0.0.1:8216; + } + # Basic Settings + default_type application/octet-stream; + sendfile on; + tcp_nopush on; + server_names_hash_bucket_size 128; keepalive_timeout 120s; - gzip on; + #the maximum allowed size of the client request body,current 10G + client_max_body_size 10240m; + client_body_buffer_size 128k; + + #set the time wait for connect to proxy_pass target,avoid waiting too long + proxy_connect_timeout 10s; + proxy_read_timeout 120s; + 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_buffers 4 32k; + + #set the nginx_cache parameter + #proxy_cache_path temp/proxy_cache levels=1:2 keys_zone=nginx_cache:10m inactive=1d max_size=100m; + + # Logging + access_log off; - include ../msb-enabled/*.conf; - include ../sites-enabled/*.conf; - include ../sites-enabled-mount/*.conf; -} + # Lua settings + lua_package_path "$prefix/../lualib/?.lua;;"; + lua_package_cpath "$prefix/../lualib/?.so;;"; + + lua_shared_dict ceryx 10M; + lua_code_cache on; + + server { + listen 80; + default_type text/html; + + location = / { + rewrite ^ /iui/framework redirect; + } + + location = /openo { + rewrite ^ /iui/framework redirect; + } + + location = /iui/openo { + rewrite ^ /iui/framework redirect; + } + + location = /iui/framework/login.html { + access_by_lua_file luaext/iui_auth.lua; + proxy_pass http://iui; + } + + location = /api/uiframe/v1/login { + rewrite ^ /api/umcsm/v1/login break; + proxy_pass http://umc; + header_filter_by_lua_file luaext/login.lua; + } + + location = /api/uiframe/v1/loginOut { + access_by_lua_file luaext/logout.lua; + rewrite ^ /api/umcsm/v1/loginOut break; + proxy_pass http://umc; + } + + location = /api/hsif/v1/authentication { + access_by_lua_file luaext/make_authed.lua; + } + + location /iui { + access_by_lua_file luaext/iui_auth.lua; + proxy_pass http://iui; + } + + location ~ ^/api/(?:vim|nsoc)/v1 { + access_by_lua_file luaext/auth.lua; + proxy_pass http://nsoc; + } + + location = /api/nsoc/v1/vnfgrantinfo { + rewrite ^ /api/vim/v1/vnfgrantinfo break; + access_by_lua_file luaext/auth.lua; + proxy_pass http://nsoc; + } + + location /api/nsocnotification/v1 { + rewrite ^/api/nsocnotification/v1/(.*) /nsocnotification/v1/$1 break; + access_by_lua_file luaext/auth.lua; + proxy_pass http://nsoc; + } + + location ~ ^/api/(?:roc|rocnotification)/v1 { + access_by_lua_file luaext/auth.lua; + proxy_pass http://roc; + } + + location /api/uiframe/v1 { + rewrite ^/api/uiframe/v1/(.*) /api/umcsm/v1/$1 break; + access_by_lua_file luaext/iui_auth.lua; + proxy_pass http://umc; + } + + location ~ ^/api/umc(?:pm|fm|drill|sm|monitor)/v1 { + access_by_lua_file luaext/auth.lua; + proxy_pass http://umc; + } + + location ~ ^/api/ssh/v1 { + proxy_pass http://ssh; + } + + location ~ ^/api/yamlparser/v1 { + proxy_pass http://yamlparser; + } + + location ~ ^/api/(?:dac|dacnotification)/v1 { + access_by_lua_file luaext/auth.lua; + proxy_pass http://dac; + } + + location /api/cmccia/v1 { + access_by_lua_file luaext/auth.lua; + proxy_pass http://cmcc; + } + + location /api/tackeria/v1 { + access_by_lua_file luaext/auth.lua; + proxy_pass http://tacker; + } + + location /winery { + access_by_lua_file luaext/auth.lua; + proxy_pass http://winery; + } + + location = /api/microservices/v1/apiRoute { + access_by_lua_file luaext/auth.lua; + content_by_lua_file luaext/serviceaccess.lua; + } + + location /api/umcswagger/v1 { + rewrite ^/api/umcswagger/v1/(.*) /api/$1 break; + access_by_lua_file luaext/auth.lua; + proxy_pass http://umc; + } + + location /api/etsiia/v1 { + access_by_lua_file luaext/auth.lua; + proxy_pass http://etsi; + } -stream { - include ../stream-enabled/*; + location /api/odlsdnia/v1 { + access_by_lua_file luaext/auth.lua; + proxy_pass http://odlsdn; + } + } } |