Divide the MSB source codes into two repos
[msb/apigateway.git] / openresty-ext / src / assembly / resources / openresty / nginx / sites-enabled / sampleplugin
1 #
2 # Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 server {
17         listen 10088;
18         default_type text/html;
19         
20         location = /sampleplugin {
21                 set $backend "";
22                 access_by_lua_block {
23                         msb.access()
24                 }
25                 proxy_pass http://$backend;  
26         }
27 }
28 server {
29         listen 10089;
30         default_type text/html;
31         
32         location = /sayhello {
33                 content_by_lua_block {
34                         local username = ngx.var.arg_name
35                         if(not username) then
36                                 username = "stranger"
37                         end
38                         ngx.say("Hello "..username.."!")
39                 }
40         }
41 }