Setup Localhost web server in Termux | Android

What is Localhost ?


In computer networking, localhost is a hostname that means this computer. It is used to access the network services that are running on the host via the loopback network interface. Using the loopback interface bypasses any local network interface hardware.
The local loopback mechanism may be used to run a network service on a host without requiring a physical network interface, or without making the service accessible from the networks the computer may be connected to. For example, a locally installed websitemay be accessed from a Web browser by the URL http://localhost to display its home page.

How to Setup localhost web server ?

We can setup localhost web server using different web servers. They are following
We can use MyServer tool to start localhost web server in linux or Android devices.

CLI Commands :

Example : myserver -s -ng localhost 8080 /home/www
  • myserver -s <hostname/ip> <localhost_port> <document_root_path> to start default localhost server.
  • myserver -s -ng <hostname/ip> <localhost_port> <document_root_path> to start Nginx web server.
  • myserver -s -php <hostname/ip> <localhost_port> <document_root_path> to start php localhost server.
  • myserver -s -py <hostname/ip> <localhost_port> <document_root_path> to start python localhost server.
  • myserver -h <domain_name> <localhost_port> <http_port/https_port> to access localhost server on internet.
  • myserver -db [start/stop] to start/stop mysql database server.
  • myserver -s apache to start apache web server.
  • myserver update update MyServer.
  • myserver rm -t uninstall MyServer.
  • myserver start start MyServer menu.
  • myserver -s to start Server that was previously running.
  • myserver -h to access from web that was previously accessed.

Menual Use :

  • Type 1 : to start your localhost web server.
  • Type 2 : to access your website from internet.
  • Type 3 : to start MySQL Database server.
  • Type 4 : to start menual localhost server.
  • Type 5 : to menual host.
  • Type 6 : to update MyServer.
  • Type 7 : for server setting.
  • Type 8 : to about us.
  • Type x : to exit.

Start php localhost server :


  • myserver -s -php localhost 8080 /sdcard/www
It will start the php localhost server in your device.


To access localhost server open the browser and type http://localhost:8080 or http://127.0.0.1:8080

MyServer Support :

  • Apache2 server.
  • nginx server.
  • PHP server.
  • Python web server.
  • MySQL Database server.
You can setup localhost we server and database server using myserver



Comments

Post a Comment