How to connect a local Rails site via Mobile (my samsung) locally?

I have a rails site that I am developing on localhost Ubuntu and I have a mobile one. My site works at http: // localhost: 3000

Now I want to access this directly through my mobile browser without going through the Internet.

Is there any way to access it via Wi-Fi or otherwise?

+11
ruby-on-rails wifi mobile-phones
source share
5 answers

If your computer is accessible from the Internet, simply log in to your mobile browser:

http://your.ip:3000/ 

You can also create a local network (for example, via Wi-Fi), connect to it using your mobile phone, and then do the same.

If you are using Rails 4.2+, start the server using:

  rails server -b 0.0.0.0 

(see http://edgeguides.rubyonrails.org/4_2_release_notes.html#default-host-for-rails-server ).

+24
source share

Using ngrok

So basically you run the command

 ./ngrok http 3000 

And you will see such a conclusion ngrok output

And all you need to do is copy the highlighted URL and paste into the browser.

+9
source share

Run

 rails s -b IP_ADDRESS 

Mobile Access: IP_ADDRESS: 3000

+8
source share

1.) get your local ip by typing:

ifconfig |grep inet

into your shell / terminal. your ip usually looks like this: 192.xxx.xxx.xx

2.) then start the rails server with:

rails server -b 0.0.0.0

3.) Your application can now be obtained by typing:

192.xxx.xxx.xx:3000 in the browser.

+4
source share
  • First, find your IP and write it down by typing ifconfig terminal (you must be connected to Wi-Fi or network).

Ifconfig

how to start the rail server by typing

rails -b server 0.0.0.0 (your IP address)

and press Enter. SERVER WILL WORK ON YOUR_IP: 3000 2. Now connect your mobile phone to the same network and open url

https: // YOUR_IP: 3000 CONGRATULATIONS YOU WORK LOCAL ON MOBILE

+2
source share

All Articles