'iPhone access to local web server through USB connection on Linux

I'm running a Nginx Web server on my Linux system and I would like to access it on my iPhone (Safari or through my iOS app) when I connect it through USB cable. How can I do it? is there any available solution?

Having iPhone and Linux system in a same network and access through its iP is not a solution here.



Solution 1:[1]

You can use ngrok. Here is a step-by-step guide:

  1. Download ngrok (https://ngrok.com/download) and move executable to /usr/bin/.
  2. Register here and copy your auth token.
  3. Open the terminal (Ctrl+Alt+T or Ctrl+Alt+F3) and type:
cd
ngrok authtoken <YOUR_AUTHTOKEN>
ngrok http 80

It will give you some URL address. Open it on your iPhone. Your home page will be shown.
More info on ngrok: https://ngrok.com/docs/secure-tunnels

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1