Update 'README.md'

This commit is contained in:
William Mantly 2018-02-14 17:37:34 +00:00
parent c7f2926c5a
commit 0fb9d2d13c

View File

@ -1,20 +1,23 @@
# proxy # proxy
## Install openresty ## API docs
[API dpcs](api.md)
## Install redis ## Server set up
## install lua plugin * Install openresty
* Install redis
* install lua plugin
```bash ```bash
apt install luarocks apt install luarocks
sudo luarocks install lua-resty-auto-ssl sudo luarocks install lua-resty-auto-ssl
``` ```
* openresty config
Set up fail back SSL certs
## openresty config
```bash ```bash
mkdir /etc/ssl/ mkdir /etc/ssl/
@ -25,7 +28,7 @@ openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj '/CN=sni-suppo
``` ```
/etc/openresty/nginx.conf change the `/etc/openresty/nginx.conf to have this config`
``` ```
#user nobody; #user nobody;
@ -107,7 +110,7 @@ http {
``` ```
/etc/openresty/autossl.conf add the SSL config file `/etc/openresty/autossl.conf`
``` ```
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@ -130,7 +133,7 @@ http {
``` ```
/etc/openresty/sites-enabled/000-proxy Add the proxy config `/etc/openresty/sites-enabled/000-proxy`
``` ```
@ -162,7 +165,7 @@ server {
return ngx.exit(500) return ngx.exit(500)
end end
local host, err = red:hget(key, "ip") local host, err = red:hget("proxy_host_"..key, "ip")
if not host then if not host then
ngx.log(ngx.ERR, "failed to get redis key: ", err) ngx.log(ngx.ERR, "failed to get redis key: ", err)
return ngx.exit(500) return ngx.exit(500)
@ -188,6 +191,8 @@ server {
} }
``` ```
## ref ## ref
https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html