103 openresty 的helloworld(day03)

1,openresty 模块在页面显示helloworld

[root@192 conf]# pwd
/usr/local/openresty/nginx/conf
[root@192 conf]# cat nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  www.server1.com;
       
 location /lua {
            content_by_lua       'ngx.say ("hello world")';
 
        }
 location / {
  root html;
  index index.html index.htm;
 }      
 
        location = /50x.html {
            root   html;
        }
    }
}
[root@192 conf]#

[root@192 conf]# curl www.server1.com/lua
hello world
[root@192 conf]#

2,

[root@192 conf]# cat nginx.conf

worker_processes  1;

events {

    worker_connections  1024;

}

http {

    include       mime.types;

    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {

        listen       80;

        server_name  www.server1.com;

 

       location /test_url {

                     echo "url:$uri";

                     echo "full url : $host$request_uri";

       }

 

 

       location / {

              root html;

              index index.html index.htm;

       }      

 

        location = /50x.html {

            root   html;

        }

    }

}

[root@192 conf]# curl www.server1.com/test_url?a=1&b=3

url:/test_url

full url : www.server1.com/test_url?a=1

 103 openresty 的helloworld(day03)

3,

 

   server_name  www.server1.com;

       

       location /test_url {

                     echo "url:$uri-----args:$args";

                     echo "args-a:$args_a";

       }

 

 103 openresty 的helloworld(day03)

4,

server_name  www.server1.com;

location /test_def {

       set $name "rainbow";

       echo_exec /test_def2;  ##内部跳转,可以传递变量

}

location /test_def2 {

       echo “url2=$name”;

}

103 openresty 的helloworld(day03)

 

上一篇:ansible剧本初使用-day03--搭建nfs和rsync


下一篇:java基础:Day03 方法的定义、重载;一维、二维数组