Now Reading
This web page is hosted on my Android cellphone

This web page is hosted on my Android cellphone

2023-05-15 00:53:17

This weblog is working on my $180 Android cellphone working Android 11. This publish describes how I turned my
Android gadget into an internet server which will be accessed from a public URL, and the way you are able to do it too.

I used Termux, which
is an Android terminal emulator on which we will run an internet server similar to a Node.js http-server, and Pinggy for acquiring
public URLs for accessing that server.

To offer you a glimpse of the setup, listed below are some pictures. The primary picture reveals the Node.js http-server
working, whereas the second picture shows Pinggy’s terminal consumer interface displaying the reside
requests to the web site as they arrive.

Android phone with node http server on termux
Android phone with pinggy running on termux

Observe these easy steps to serve your individual webpage out of your Android cellphone.

Step 1. Set up Termux

Termux is an software for Android
that emulates a terminal and Linux atmosphere. In contrast to different comparable apps, it doesn’t require rooting
or any further setup. It comes with a fundamental system, and you may set up extra packages utilizing the APT
bundle supervisor.

You will get the Termux app on F-Droid by way of this F-Droid link.

You’ll be able to straight obtain the Termux APK from the web site.
Merely click on on the “Obtain APK” hyperlink situated on the backside of every model part. Learn
extra on this GitHub link.

Notice that it’s NOT essential to obtain the F-Droid app (from the “Obtain
F-Droid” hyperlink) to put in Termux.

Step 2. Set up Packages

So as to serve a webpage, we have to set up an internet server on our gadget. We additionally set up openssh
shopper which can assist us in sharing the web site later.

Replace packages:

Set up openssh shopper and Node.js:

pkg set up openssh
pkg set up nodejs-lts

As soon as these are put in accurately, it is possible for you to to examine the variations of node and
npm utilizing node --version and npm --version

Android phone showing node and npm version on termux

Step 3. Begin server and Pinggy tunnel

You’ll be able to first create a pattern HTML web page by creating an index.html file as follows:

echo "<h1>Good day World!</h1>" > index.html

You should utilize the nano editor to edit the webpage from the terminal:
nano index.html. In the event you want vim then you too can set up that.

Now begin the http-server:

Notice: we add a & on the finish of the command. This can enable the http server to
run in background. Use the fg command to carry it to foreground and press Ctrl + C
to cease it.

This can begin the server on port 8080 by default. Verify the output to verify.

Begin Pinggy to get a public URL:

ssh -p 443 -R0:localhost:8080 a.pinggy.io

You’ll get a public URL similar to https://ranxyzxxxx.a.pinggy.io, which you need to use to
entry your server working in your cellphone! Subsequent we are going to focus on easy methods to use a website or subdomain of your
alternative.

In case you get a unique port than 8080 on the above command, change it within the Pinggy
command additionally. You should utilize Ctrl + C to cease the tunnel.

See Also

Now share your URL with your pals and watch reside stats of tourists on the Pinggy terminal consumer
interface. You can too hit the return key to see particulars in regards to the the request and response headers
together with consumer agent, and many others.

The primary picture above reveals the Node.js http-server working and listening on port 8080. The second
screenshot reveals the Pinggy tunnel beginning and offering a public URL. It is usually displaying the reside
customer requests to the server. The third screenshot reveals extra particulars a few specific request.

Join it to your individual area

You can too use your individual area or select a subdomain for accessing this server. Or you too can select
an appropriate subdomain similar to https://myandroidblog.a.pinggy.io .

First it is advisable to sign-up for Pinggy and subscribe to Pinggy Professional. Then go to the
dashboard and click on on Customized Domains on the nav bar.

Put your individual customized area that you just need to use and Pinggy will present a CNAME file that it is advisable to
configure in your DNS settings of the area.

After the CNAME file is about, simply click on Validate adopted by Challenge Certificates button to complete
configuring the customized area.

Pinggy custom domain configuration page

As soon as the customized area is configured, simply use the token from Pinggy dashboard within the pinggy tunnel
command:

ssh -p 443 -R0:localhost:8080  <put your pinggy token right here>@a.pinggy.io

In conclusion, internet hosting an internet site or weblog from an Android gadget might look like an unattainable feat, however
with the best instruments, it’s fairly achievable. On this weblog publish, we’ve got explored the steps required to
flip your Android gadget into an internet server that may be accessed from a public URL or your individual area. By
utilizing an Android terminal emulator like Termux and acquiring a public URL by way of Pinggy, you’ll be able to simply
create and share your content material with the world. So, why not give it a try to see what artistic concepts you
can carry to life by yourself private net server?

Source Link

What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top