Tag : Nginx

Background of Container Cloud With the popularization of micro-service architecture and the combination of open source micro-service frameworks such as Dubbo and Spring Cloud, many business lines within Yixin have gradually shifted from the original single architecture to micro-service architecture. Applications change from stateful to stateless, specifically storing business state data such as session and ..

Read more

Js reported an error net::ERR_INCOMPLETE_CHUNKED_ENCODING Error log for nginx 2016/06/05 20:49:17 [xxx] 22239#0: *29366 open() “/usr/local/openresty/nginx/proxy_temp/0/15/0000000150″ failed (13: Permission denied) while reading upstream…” View proxy_temp permissions drwxr-xr-x 12 nobody root 4096 Feb 17 02:53 proxy_temp drwxr-xr-x 2 root root 4096 Feb 17 02:40 sbin drwx—— 2 nobody root 4096 Feb 17 02:53 scgi_temp drwx—— 2 ..

Read more

Env defined in global configuration events{ … } env BPM_SERVICE_HOST; env BPM_SERVICE_PORT; Get from service set_by_lua $bpm_host ‘return os.getenv(“BPM_SERVICE_HOST”)’; set_by_lua $bpm_port ‘return os.getenv(“BPM_SERVICE_PORT”)’; Lua local host=ngx.var.bpm_host doc How can I use environment variables in ..

Read more

The load balancing scheduler allows users not to care about the back-end servers to the greatest extent. We know that when RR scheduling policy is adopted, even multiple requests for the same content by the same user may be forwarded to different back-end servers, which sounds fine, but sometimes it may bring some problems.After a ..

Read more

Configure $request_time in http log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘ ‘$status $body_bytes_sent “$http_referer” ‘ ‘”$http_user_agent” “$http_x_forwarded_for” $request_time’; Example 11.1.27.0 – – [23/Dec/2016:20:22:29 +0800] “GET /demo.js HTTP/1.1” 200 119206 “http://localhost/demo” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 Firefox/50.0”..

Read more

Example ngx.header[“Set-Cookie”] = { “userId=” .. userId .. “; Max-Age=7200 ; Path=/; HttpOnly”, “orgId=” .. orgId .. “; Max-Age=7200 ; Path=/; HttpOnly” } Traversal cookie header_filter_by_lua ‘ local cookies = ngx.header.set_cookie if cookies then if type(cookies) == “table” then for k,v in pairs(cookies) do ngx.log(ngx.INFO,”k:”..k..”,value:”..v) end else ngx.log(ngx.INFO,”cookie:”..cookies) ..

Read more

log_format log_format main ‘$http_userId $http_userName $remote_addr $remote_user [$time_local] “$request” ‘ ‘$status $body_bytes_sent “$http_referer” ‘ ‘”$http_user_agent” “$http_x_forwarded_for” $request_time’; Get via http_argname Set header ngx.req.set_header(“userId”,xxx) ngx.req.set_header(“userName”,xxx) Set after verifying login in rewrite_b..

Read more

SIGINT SIGTERM SIGKILL distinction All three are to end/terminate the process. 1.SIGINT SIGTERM difference The former is associated with the character ctrl+c, while the latter has no control character association.The former can only end the foreground process, while the latter is not. 2. the difference between sigtermsigkill The former can be blocked, handled and ignored, ..

Read more

post res = ngx.location.capture(‘/update’,{method = ngx.HTTP_POST,body = “name=” .. name .. “&content=” .. content}) Parsing json local cjson = require(“cjson”) local data = cjson.decode(res.body) If the return is not in json format, this lua script will report an error Expected value but found invalid token at character 1 stack traceback: coroutine 0: [C]: in function ..

Read more

abnormal upstream server temporarily disabled while connecting to upstream no live upstreams while connecting to upstream Max_fails and fail_timeout Max_fails defaults to 1 and 1,fail_timeout defaults to 10 seconds. Nginx can set the number of failed attempts and failure time of nodes by setting max _ failures (maximum number of failed attempts) and fail_timeout (failure ..

Read more