stream { upstream leylines { server 127.0.0.1:31338; } server { listen your_public_ip:31337 ssl; proxy_pass leylines; ssl_certificate /etc/letsencrypt/live/your_domain_name/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/your_domain_name/privkey.pem; include options-ssl-stream.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; } }