sometimes, we need to access virtual machine(Guest System) from external environment not local machine(Host System). at this time, if you use
ngrok, you can access simply.
below link is the virtual machine(Guest System) for Laravel by Ansible to test
the instruction of
ngrok we’ll talk in there is for developing and testing.
- ngrok official site: https://ngrok.com/
the virtual machine(Gust System) in below link is
|-- ansible | |-- init | | |-- tasks | | | |-- main.yml | |-- docker | | |-- tasks | | | |-- main.yml | |-- laradock | | |-- tasks | | | |-- main.yml | |-- php | | |-- tasks | | | |-- main.yml |-- Vagrantfile
we need to add
ngrok, so create ansible/ngrok/taskas/main.yml file.
|-- ansible | |-- init | | |-- tasks | | | |-- main.yml | |-- docker | | |-- tasks | | | |-- main.yml | |-- laradock | | |-- tasks | | | |-- main.yml | |-- php | | |-- tasks | | | |-- main.yml | |-- ngrok | | |-- tasks | | | |-- main.yml |-- Vagrantfile
ansible/ngrok/tasks/main.yml and modify it like below.
--- - name: Unarchive ngrok become: true unarchive: src: ngrok.zip dest: /vagrant tags: - ngrok
role just unarchives the file. let’s download the file needed at here.
- ngrok download site: https://ngrok.com/download
or you can download from our repository.
- laravel-devtool github: laravel-devtool
copy it to
ansible/playbook.yml like below to use
--- - hosts: localhost connection: local roles: - init - docker - laradock - php - ngrok
Execute Virtual Machine
execute below command to start the virtual machine(Guest System).
if you execute this for the first time, it takes a long time. also, it executes automatically
ngrok setting we added above.
if you’ve already executed the virtual machine with our Ansible configuration, you need to do belows.
# vagrant up vagrant ssh sudo ansible-playbook /vagrant/ansible/playbook.yml --tags 'ngrok'
execute below command to start
# vagrant ssh cd /vagrant/ ./ngrok http 80
and then, you can see below screen.
Session Status online Session Expires 7 hours, 59 minutes Version 2.2.8 Region Asia Pacific (ap) Web Interface http://127.0.0.1:4040 Forwarding http://cf354047.ap.ngrok.io -> localhost:80 Forwarding https://cf354047.ap.ngrok.io -> localhost:80
you can access the virtual machine(Guest System) by
Forwarding URL in here. this is only for testing and developing, use it when you develop or test the application.
to develop api server for App, you can easily use api server on the virtual machine(Guest System) in the local machine(Host System) by
you can see our Laravel virtual machine(Guest System) by Ansible, at below link.
Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!
Deku. 지금 보고 계신 블로그를 작성하는
Deku가 개발한 앱을 한번 사용해보세요.
Dekucreated the applications with Flutter.
If you have interested, please try to download them for free.