如下是nginx.conf,很简单的一个配置文件。
为啥我用RESTClient不论向127.0.0.1:8011发送get,还是post请求,均返回508...
在浏览器上直接访问127.0.0.1:8011,什么也不返回
难道是因为upstream qq_backend中的server有问题吗?
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
lua_shared_dict _ups_zone 64m; # 定义upstream共享内存空间
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8011;
error_log /home/liycq/lua/nginx1.10.2/logs/error.log debug;
server_name somename alias another.alias;
location = /redis {
internal;
set_unescape_uri $key $arg_key;
#ngx.log(ngx.ERR, "redis returned empty body")
redis2_query get $key;
redis2_pass 127.0.0.1:6380;
}
location / {
proxy_pass http://qq_backend;
#proxy_pass http://$target;
}
location = /lua-version {
default_type 'text/plain';
content_by_lua '
if jit then
ngx.say(jit.version)
else
ngx.say(_VERSION) end
';
}
}
upstream qq_backend{
server 14.17.42.40;
server 14.17.32.211;
server 59.37.96.63;
}
}
如下是error.log中内容:
2016/11/23 20:04:06 [notice] 29393#0: signal process started
2016/11/23 20:04:21 [info] 29394#0: *66 client closed connection while waiting for request, client: 10.129.30.62, server: 0.0.0.0:8011
2016/11/23 20:05:41 [info] 29394#0: *70 client closed connection while waiting for request, client: 10.129.30.62, server: 0.0.0.0:8011