August 3, 2019 · Web Server Ubuntu

Free version of Ngrok, aka SSH reverse tunnel

Setup it by nginx config and reverse ssh tunnel

nginx config

server {
    server_name tunnel.yourdomain;

    access_log /var/log/nginx/$host;
    
    # These three lines are new.
    #listen 443 ssl;
    #ssl_certificate /path/to/tls/cert/fullchain.pem;
    #ssl_certificate_key /path/to/tls/cert/privkey.pem;

    location / {
     proxy_pass http://localhost:3333/;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header Host $host;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
     proxy_redirect off;
    }

    error_page 502 /50x.html;
    location = /50x.html {
     root /usr/share/nginx/html;
    }
}

and bash this

#bash this @ local
ssh -R 3333:localhost:80 yourdomain

Originally from:
https://jerrington.me/posts/2019-01-29-self-hosted-ngrok.html