Skip to content

Commit

Permalink
doc: fixed escaping issues in the configuration samples in the Synops…
Browse files Browse the repository at this point in the history
…is seciton by migrating to the *_by_lua_block {} directives. thanks whatacold for the report in #8.
  • Loading branch information
agentzh committed Dec 7, 2015
1 parent 3f47c2b commit 4d1ef91
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions README.markdown
Expand Up @@ -45,17 +45,15 @@ http {
lua_socket_log_errors off;
init_worker_by_lua '
init_worker_by_lua_block {
local hc = require "resty.upstream.healthcheck"
local ok, err = hc.spawn_checker{
shm = "healthcheck", -- defined by "lua_shared_dict"
upstream = "foo.com", -- defined by "upstream"
type = "http",
-- if you put this Lua snippet in separate .lua file,
-- then you should write this instead: http_req = "GET /status HTTP/1.0\r\nHost: foo.com\r\n\r\n",
http_req = "GET /status HTTP/1.0\\r\\nHost: foo.com\\r\\n\\r\\n",
http_req = "GET /status HTTP/1.0\r\nHost: foo.com\r\n\r\n",
-- raw HTTP request for checking
interval = 2000, -- run the check cycle every 2 sec
Expand All @@ -74,7 +72,7 @@ http {
-- more upstream groups to monitor. One call for one upstream group.
-- They can all share the same shm zone without conflicts but they
-- need a bigger shm zone for obvious reasons.
';
}
server {
...
Expand All @@ -86,11 +84,11 @@ http {
deny all;
default_type text/plain;
content_by_lua '
content_by_lua_block {
local hc = require "resty.upstream.healthcheck"
ngx.say("Nginx Worker PID: ", ngx.worker.pid())
ngx.print(hc.status_page())
';
}
}
}
}
Expand All @@ -109,7 +107,7 @@ Methods
Installation
============

If you are using [OpenResty](http://openresty.org) 1.5.11.1 or later, then you should already have this library (and all of its dependencies) installed by default (and this is also the recommended way of using this library). Otherwise continue reading:
If you are using [OpenResty](http://openresty.org) 1.9.3.2 or later, then you should already have this library (and all of its dependencies) installed by default (and this is also the recommended way of using this library). Otherwise continue reading:

You need to compile both the [ngx_lua](https://github.com/chaoslawful/lua-nginx-module) and [ngx_lua_upstream](https://github.com/agentzh/lua-upstream-nginx-module) modules into your Nginx.

Expand Down

0 comments on commit 4d1ef91

Please sign in to comment.