9a2db3fefa933f3e817eced40d8d1d2253d2338b
[msb/apigateway.git] / msb-core / openresty-ext / src / assembly / resources / openresty / nginx / conf / nginx.conf
1 #user xfs xfs;
2 worker_processes 1;
3
4 error_log logs/error.log warn;
5 pid logs/nginx.pid;
6
7 events {
8     worker_connections 1024;
9 }
10
11 http {
12         include mime.types;
13
14     upstream iui {
15         server 127.0.0.1:8202;
16     }   
17
18     upstream nsoc {
19         server 127.0.0.1:8203;
20     }
21
22     upstream roc {
23         server 127.0.0.1:8204;
24     }
25
26     upstream umc {
27         server 127.0.0.1:8205;
28     }
29
30     upstream ssh {
31         server 127.0.0.1:8209;
32     }
33         
34         upstream yamlparser {
35         server 127.0.0.1:8210;
36     }
37
38     upstream dac {
39         server 127.0.0.1:8206;
40     }
41
42     upstream cmcc {
43         server 127.0.0.1:8207;
44     }
45
46     upstream tacker {
47         server 127.0.0.1:8208;
48     }
49
50     upstream winery {
51         server 127.0.0.1:8080;
52     }
53         
54         upstream etsi {
55         server 127.0.0.1:8211;
56     }
57         
58         upstream openstackadapter {
59         server 127.0.0.1:8217;
60     }
61         
62         upstream vimadapter {
63         server 127.0.0.1:8218;
64     }
65
66     upstream odlsdn {
67         server 127.0.0.1:8216;
68     }
69         
70     # Basic Settings
71     default_type  application/octet-stream;   
72     sendfile       on;
73     tcp_nopush     on;
74     server_names_hash_bucket_size 128;  
75     keepalive_timeout  120s;
76         
77         #the maximum allowed size of the client request body,current 10G
78         client_max_body_size 10240m; 
79     client_body_buffer_size 128k;
80         
81         #set the time wait for connect to proxy_pass target,avoid waiting too long
82         proxy_connect_timeout 10s;
83         proxy_read_timeout 120s;
84         proxy_send_timeout 120s;
85         proxy_set_header X-Real-IP $remote_addr;
86     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
87     proxy_set_header Host $host:$server_port;
88     proxy_buffers 4 32k;
89         
90     #set the nginx_cache parameter
91     #proxy_cache_path  temp/proxy_cache  levels=1:2   keys_zone=nginx_cache:10m inactive=1d max_size=100m;
92         
93     # Logging
94     access_log off;
95
96     # Lua settings
97     lua_package_path "$prefix/../lualib/?.lua;;";
98         lua_package_cpath "$prefix/../lualib/?.so;;";
99
100     lua_shared_dict ceryx 10M;
101     lua_code_cache on;
102         
103     server {
104         listen       80;
105         default_type text/html;
106                 
107                 location = / {
108                         rewrite ^ /iui/framework redirect;
109                 }
110
111                 location = /openo {
112                         rewrite ^ /iui/framework redirect;
113                 }
114
115                 location = /iui/openo {
116                         rewrite ^ /iui/framework redirect;
117                 }
118                 
119                 location = /iui/framework/login.html {
120                         access_by_lua_file luaext/iui_auth.lua;
121                         proxy_pass http://iui;
122                 }
123
124                 location = /api/uiframe/v1/login {
125                         rewrite ^ /api/umcsm/v1/login break;
126                         proxy_pass http://umc;
127                         header_filter_by_lua_file luaext/login.lua;
128                 }
129                 
130                 location = /api/uiframe/v1/loginOut {
131                         access_by_lua_file luaext/logout.lua;
132                         rewrite ^ /api/umcsm/v1/loginOut break;
133                         proxy_pass http://umc;          
134                 }               
135                 
136                 location = /api/hsif/v1/authentication {
137                         access_by_lua_file luaext/make_authed.lua;
138                 }               
139
140                 location /iui {
141                         access_by_lua_file luaext/iui_auth.lua;
142                         proxy_pass http://iui;
143                 }
144
145                 location ~ ^/api/(?:vim|nsoc)/v1 {
146                         access_by_lua_file luaext/auth.lua;
147                         proxy_pass http://nsoc;
148                 }
149                 
150                 location = /api/nsoc/v1/vnfgrantinfo {
151                         rewrite ^ /api/vim/v1/vnfgrantinfo break;
152                         access_by_lua_file luaext/auth.lua;
153                         proxy_pass http://nsoc;
154                 }               
155                 
156                 location /api/nsocnotification/v1 {
157                         rewrite ^/api/nsocnotification/v1/(.*) /nsocnotification/v1/$1 break;
158                         access_by_lua_file luaext/auth.lua;
159                         proxy_pass http://nsoc;
160                 }               
161
162                 location ~ ^/api/(?:roc|rocnotification)/v1 {
163                         access_by_lua_file luaext/auth.lua;
164                         proxy_pass http://roc;
165                 }
166
167                 location /api/uiframe/v1 {
168                         rewrite ^/api/uiframe/v1/(.*) /api/umcsm/v1/$1 break;
169                         access_by_lua_file luaext/iui_auth.lua;
170                         proxy_pass http://umc;
171                 }
172         
173                 location ~ ^/api/umc(?:pm|fm|drill|sm|monitor)/v1 {
174                         access_by_lua_file luaext/auth.lua;
175                         proxy_pass http://umc;
176                 }
177
178                 location ~ ^/api/ssh/v1 {
179                         proxy_pass http://ssh;
180                 }
181                 
182                 location ~ ^/api/yamlparser/v1 {
183                         proxy_pass http://yamlparser;
184                 }
185                 
186                 location ~ ^/api/(?:dac|dacnotification)/v1 {
187                         access_by_lua_file luaext/auth.lua;
188                         proxy_pass http://dac;
189                 }
190
191                 location /api/cmccia/v1 {
192                         access_by_lua_file luaext/auth.lua;
193                         proxy_pass http://cmcc;
194                 }
195
196                 location /api/tackeria/v1 {
197                         access_by_lua_file luaext/auth.lua;
198                         proxy_pass http://tacker;
199                 }
200
201                 location /winery {
202                         access_by_lua_file luaext/auth.lua;
203                         proxy_pass http://winery;
204                 }
205                 
206                 location = /api/microservices/v1/apiRoute {
207                         access_by_lua_file luaext/auth.lua;
208                         content_by_lua_file luaext/serviceaccess.lua;
209                 }
210                 
211                 location /api/umcswagger/v1 {
212                         rewrite ^/api/umcswagger/v1/(.*) /api/$1 break;
213                         access_by_lua_file luaext/auth.lua;
214                         proxy_pass http://umc;
215                 }
216                 
217                 location /api/etsiia/v1 {
218                         access_by_lua_file luaext/auth.lua;
219                         proxy_pass http://etsi;
220                 }
221
222                 location /api/odlsdnia/v1 {
223                         access_by_lua_file luaext/auth.lua;
224                         proxy_pass http://odlsdn;
225                 }
226     }   
227 }