<html><head><meta http-equiv="content-type" content="text/html; charset=GB2312"><style>body { line-height: 1.5; }p { margin-top: 0px; margin-bottom: 0px; }body { font-size: 10.5pt; font-family: 'Microsoft YaHei UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span><span microsoft="" yahei="" ui';="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">the nginx.conf as below:<br><br>upstream my_server {<br><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"> </span>server localhost:8095;<br><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"> </span>keepalive 2000;<br>}<br><br>location /private/rush2purchase/ {<br><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"> </span>limit_conn addr 20;<br><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"> </span>proxy_pass http://my_server/private/rush2purchase/;<br><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"> </span>proxy_set_header Host $host:$server_port;<br><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"> </span>rewrite_by_lua_file D:/tmp/lua/draw_r.lua;<br><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"> </span><font color="#003366"><b>log_by_lua_file</b> </font>D:/tmp/lua/draw_decr.lua;<br>}</span></div><div><span microsoft="" yahei="" ui';="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'=""><br>when I send request to </span><a href="http://localhost/private/rush2purchase/" microsoft="" yahei="" ui';="" font-size:="" 14px;="" font-weight:="" normal;="" font-style:="" normal;'="" style="font-size: 10.5pt; line-height: 1.5; background-color: window;">http://localhost/private/rush2purchase/</a><span microsoft="" yahei="" ui';="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="" style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> ,it works fine the the stream server is up,</span></div><span microsoft="" yahei="" ui';="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'=""></span><div><span microsoft="" yahei="" ui';="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">but when I shutdown the upstream server</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">(port:8095)</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">,I find the code not executed in <b><font color="#003366">log_by_lua_file </font></b>(draw_decr.lua).</span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div><b>info in nginx access.log:</b></div><div><span microsoft="" yahei="" ui';="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgba(0,="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">127.0.0.1 - - [01/Dec/2017:21:03:20 +0800] "GET /private/rush2purchase/ HTTP/1.1" <b><font color="#ff0000">504 </font></b>558 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3236.0 Safari/537.36"<br></span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div><b><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">error message in </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">nginx</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">error.log</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">:</span></b></div><div><span microsoft="" yahei="" ui';="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgb(255,="" 255,="" 255);="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'="">2017/12/01 21:02:20 [error] 35292#42868: *3298 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /private/rush2purchase/ HTTP/1.1", upstream: "http://[::1]:8095/private/rush2purchase/", host: "localhost"<br>2017/12/01 21:03:20 [error] 35292#42868: *3298 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /private/rush2purchase/ HTTP/1.1", upstream: "http://127.0.0.1:8095/private/rush2purchase/", host: "localhost"<br></span></div><div><span microsoft="" yahei="" ui';="" font-size:="" 14px;="" color:="" rgb(0,="" 0,="" 0);="" background-color:="" rgb(255,="" 255,="" 255);="" font-weight:="" normal;="" font-style:="" normal;text-decoration:="" none;'=""><br></span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">How to fix it?</span></div><div><br></div>
<div><br></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span style="font-size: 12px;"><div style="margin: 10px;"><p style="margin: 3.75pt 0cm; orphans: 2; widows: 2; line-height: 21px;"><font face="΢ÈíÑźÚ, sans-serif">Tong</font></p></div></span></div>
</body></html>