Merge branch 'master' of https://git.theta42.com/wmantly/proxy
This commit is contained in:
commit
c62461350b
47
README.md
47
README.md
@ -1,20 +1,43 @@
|
||||
# proxy
|
||||
|
||||
## Install openresty
|
||||
## API docs
|
||||
[API dpcs](api.md)
|
||||
|
||||
## Install redis
|
||||
## Server set up
|
||||
|
||||
## install lua plugin
|
||||
The server requires:
|
||||
* NodeJS 8.x
|
||||
* open ssh server(any modern version will do)
|
||||
* inbound Internet access
|
||||
* redis
|
||||
* lua rocks
|
||||
|
||||
This has been tested on ubuntu 16.04, but should work on any modern Linux distro. It used the Linux users for its user management, so this will **ONLY** work on Linux, no macOS, BSD or Windows.
|
||||
|
||||
The steps below are for a new ubuntu server, they should be mostly the same for other distros, but the paths and availability of packages may vary.
|
||||
|
||||
* Install open ssh server
|
||||
```bash
|
||||
apt install ssh
|
||||
```
|
||||
|
||||
* Install openresty
|
||||
[OpenResty® Linux Packages](https://openresty.org/en/linux-packages.html)
|
||||
|
||||
* Install redis
|
||||
```bash
|
||||
apt install redis-server
|
||||
```
|
||||
|
||||
* install lua plugin
|
||||
```bash
|
||||
apt install luarocks
|
||||
sudo luarocks install lua-resty-auto-ssl
|
||||
```
|
||||
|
||||
* openresty config
|
||||
|
||||
|
||||
## openresty config
|
||||
|
||||
|
||||
Set up fail back SSL certs
|
||||
```bash
|
||||
mkdir /etc/ssl/
|
||||
|
||||
@ -25,7 +48,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;
|
||||
@ -107,7 +130,7 @@ http {
|
||||
```
|
||||
|
||||
|
||||
/etc/openresty/autossl.conf
|
||||
add the SSL config file `/etc/openresty/autossl.conf`
|
||||
|
||||
```
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
@ -130,7 +153,7 @@ http {
|
||||
```
|
||||
|
||||
|
||||
/etc/openresty/sites-enabled/000-proxy
|
||||
Add the proxy config `/etc/openresty/sites-enabled/000-proxy`
|
||||
|
||||
|
||||
```
|
||||
@ -162,7 +185,7 @@ server {
|
||||
return ngx.exit(500)
|
||||
end
|
||||
|
||||
local host, err = red:hget(key, "ip")
|
||||
local host, err = red:hget("proxy_host_"..key, "ip")
|
||||
if not host then
|
||||
ngx.log(ngx.ERR, "failed to get redis key: ", err)
|
||||
return ngx.exit(500)
|
||||
@ -188,6 +211,8 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
## ref
|
||||
|
||||
https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user