Preparation
- Get a computer with system ubuntu(or other system you can use docker)
- Register two free account in ngrok
Make your computer as a remote server
We can login in our computer from remote using ssh.
- Download ngrok and unzip it.
- ./ngrok authtoken , execute this command with your ngrok token
- Use tmux to create a independent window and execute ./ngrok tcp 22. We use tmux as we can close the ngrok window without close ngrok connection. you can close tmux window with command ‘ctrl+b’ and then type ‘d’
- You can see the remote host ngrok providing now. Now use another computer. You can login you server computer use ssh command. eg: ssh username@ngrok-host -p ngrok-port. Input you password and you can login.
1
2
3
4
5
6./ngrok authtoken {{token}}
tmux
./ngrok tcp 22
ctrl+b +d
# In another computer
ssh username@ngrok-host -p
Now we have a remote server and we can ssh it. Ngrok can surely provide http host for remote request, but free ngrok account can only provide one remote request. As we use the first for ssh remote login, we can not use it for http request.
But we can use the second account for our docker server.
Make your local web server accessed from remote.
- You can run a web server using docker. eg: docker run guaneagler/drupal-web
- After that, login it and use another ngrok token to export your web server.
- Then you can access the server using host ngrok providing.
docker run guaneagler/drupal-web docker exec -it container-name bash ./ngrok authtoken {{token}} tmux ./ngrok http 80 ctrl+b +d