1. yum repo 구성

   yum install -y yum-utils


   yum-config-manager --add-repo   https://openresty.org/package/centos/openresty.repo


   wget -qO - https://openresty.org/package/pubkey.gpg | apt-key add - ( ubuntu)

   apt install -y software-properties-common


2. openresty 설치


   yum install -y openresty


   systemctl enable openresty


   systemctl start openresty


   add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" (ubuntu)

   apt update



3. 설정

   content_by_lua_block에 lua 코드를 써서 적용 


   location /test {

       default_type   'text/plain';

       content_by_lua_block {

ngx.say('This is test')

       }

   } 


   location /jsontest {

 default_type   'application/json';

 content_by_lua_block {

local cjson = require "cjson.safe"

ngx.say(cjson.encode({test="test...", enabled=true}))

 }

   }





'오픈소스 > nginx' 카테고리의 다른 글

nginx 디렉토리 설정예제  (0) 2018.05.04
nginx proxy 설정예제  (0) 2018.05.04
nginx pagespeed  (0) 2018.02.07
nginx 서버 파라미터 설정  (0) 2018.02.07
nginx worker 설정  (0) 2018.02.07

+ Recent posts