Add an nginx config snippet

test-action v0.0.2
Vasile Popescu 4 years ago
parent 1a438f839b
commit b9c1dd419c

@ -57,3 +57,7 @@ In the above command, `:3456` is the default port where `tty-proxy` listens for
connections (i.e. `tty-share` clients), and 5000 is the port of the web interface through which
remote users can connect. You can override the defaults by specifying a different port mapping on
the command line, e.g. `-p 4567:3456 -p 80:8080` to listen on `4567` and serve on `80`.
## nginx
Take a look at [this snippet](doc/nginx.conf) to see how I configured my nginx installation for TLS termination.

@ -0,0 +1,62 @@
# This is not a complete nginx config file, but only some snippets to show how I configured my
# installation.
# If the stream module is dynamic (nginx -V), then you have to load it manually with
load_module /usr/lib64/nginx/modules/ngx_stream_module.so;
# Also, you will probably have to install the stream module separately, if the line above fails when
# nginx starts. On Fedora, you can do it with `dnf install nginx-mod-stream` and then see its
# location with `rpm -ql nginx-mod-stream`.
stream {
# https://nginx.org/en/docs/stream/ngx_stream_core_module.html#server
# the tty-server tcp connection ssl proxy
server {
listen 4567 ssl so_keepalive=30m::10;
proxy_pass localhost:3456;
ssl_certificate /etc/letsencrypt/live/on.tty-share.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/on.tty-share.com/privkey.pem;
}
}
http {
# the tty-proxy server (tty-proxy) address
upstream tty-proxy {
server localhost:9000;
keepalive 12; # number of connections to keep alive even if idle, if they are opened
}
# on.tty-share.com
server {
listen 80;
server_name on.tty-share.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name on.tty-share.com;
access_log /var/log/nginx/tty-proxy.access.log proxy_log_format;
# https://stackoverflow.com/questions/19769072/nginx-times-out-exactly-after-60-seconds?rq=1
# https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout
proxy_send_timeout 1600;
proxy_read_timeout 1600;
location / {
proxy_pass http://tty-proxy;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
# TODO: use the rigth certificates here
ssl_certificate /etc/letsencrypt/live/on.tty-share.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/on.tty-share.com/privkey.pem;
}
}
Loading…
Cancel
Save