[Public Network Remote Mobile Android Server] Android Termux Build Web Server

Time:2024-5-9

catalogs

summarize

1. Set up apache

2. Install cpolar Intranet Penetration

3. Public network access configuration

4. Fixed public network address

5. Add site


summarize

Termux is an Android terminal emulation application used to build a complete Linux environment on Android phones, capable of realizing many basic operations under Linux, and does not require root privileges Termux can run normally.

Apache is an open source web server software that is widely used and is one of the most popular web server software due to its cross-platform and security. We can use Termux to build a web server on Android phones, and at the same time do intranet penetration to realize that public network users can also access, turning Android into a small cloud server.

The following is an introduction to build apache service on Android Termux to create a personal site and combined with the cpolar intranet penetration tool to achieve public access.

1. Set up apache

Execute the command to install apache, the installation is relatively simple, one-click installation can be

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">pkg <span style="color:#e6db74">install</span> apache2
</code></span></span></span></span>

Then start apache

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">apachectl start
</code></span></span></span></span>

If the following problems occur during startup

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

Solution, modify the configuration file, if it is not installedvimRun the command to install it.

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">pkg <span style="color:#e6db74">install</span> <span style="color:#e6db74">vim</span>
</code></span></span></span></span>

Edit Modify Configuration File

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell"><span style="color:#e6db74">vim</span> <span style="color:#f8f8f2">$PREFIX</span>/etc/apache2/httpd.conf
</code></span></span></span></span>

locateServerNameUncomment.www.example.comchange into127.0.0.1:8080You can change the port number to your favorite one.

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

Modify it and start it again.

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

Open your browser and typehttp://127.0.0.1:8080, you can see the apahe welcome page.

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

Stop apache

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">apachectl stop
</code></span></span></span></span>

Restart apache

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">apachectl restart
</code></span></span></span></span>

2. Install cpolar Intranet Penetration

cpolar official website:https://www.cpolar.com

After successfully creating an apache container to run the site, we next use cpolar to do intranet penetration to achieve access in a public network environment.

cpolar is a secure intranet penetration cloud service that supports http/https/tcp protocols, can be used permanently for free with unlimited traffic, and supports mapping port 80/443. It can create secure tunnels to expose local services to the public network, so that public users can also access the normal intranet services, do not need a public IP, and do not need to set up a router.

Create asources.list.dFolders of.

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell"><span style="color:#e6db74">mkdir</span> -p <span style="color:#f8f8f2">$PREFIX</span>/etc/apt/sources.list.d
</code></span></span></span></span>

Add cpolar download source file

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell"><span style="color:#e6db74">echo</span> <span style="color:#a6e22e">"deb [trusted=yes] http://termux.cpolar.com termux extras"</span> <span style="color:#f8f8f2">>></span> <span style="color:#f8f8f2">$PREFIX</span>/etc/apt/sources.list.d/cpolar.list
</code></span></span></span></span>

Update Warehouse

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">pkg update
</code></span></span></span></span>

Install cpolar

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">pkg <span style="color:#e6db74">install</span> cpolar
</code></span></span></span></span>

Installing the termux service

Caution:Remember to close and reboot termux after the installation is complete before it takes effect!!!!

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">pkg <span style="color:#e6db74">install</span> termux-services
</code></span></span></span></span>

After rebooting termux, start cpolar.

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">sv up cpolar
</code></span></span></span></span>

Setting up boot-up

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">sv-enable cpolar
</code></span></span></span></span>

This stops the cpola service.

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">sv down cpolar
</code></span></span></span></span>

cpolar.yml main configuration file path location

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell"><span style="color:#f8f8f2">$PREFIX</span>/etc/cpolar/cpolar.yml
</code></span></span></span></span>

Then in the mobile browser we typehttp://localhost:9200You can see the cpolar management interface, use the e-mail account registered in the cpolar official website to log in!

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

3. Public network access configuration

mobile browser to open the cpolar web ui management interface, we click on the left side of the dashboard of the tunnel management – to create a tunnel, due to apache above we modify the configuration file is8080port (the article is 8080, the specific port number to their own port), so we are going to come to create a http tunnel, pointing to port 8080:

  • Tunnel name: customizable, taking care not to repeat
  • Protocol: http
  • Local address: 8080
  • Domain type: select random domain name
  • Region: Select China VIP

strike (on the keyboard)establish

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

create a successful open online tunnel list, you can see the address of the public network access, there are two ways to access, one is http, one is https

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

We use the http method, enter the public address in the browser, you can access success!

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

4. Fixed public network address

As the above created a free random tunnel, generated by the public address will be randomly changed within 24 hours, in order to facilitate a long and stable connection, we can fix the public address, configure a cpolar fixed second-level sub-domain [no need for the record], or you can configure the use of your own domain name to access, here we configure a fixed second-level sub-domain to give an example.

Upgrade to Basic Package or above to support second-level sub-domain configuration.

log incpolar official website backstage, click on the left dashboard of thereserveFindReservation of second-level subdomains, reserving a second-level subdomain for the http tunnel.

  • Region: Select server region
  • Name: fill in the second-level subdomain you want to keep (customizable)
  • Description: i.e. notes, can be customized to fill in

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

This example reserves a namemywebsitetestof the second-level subdomain. Once the subdomain was successfully reserved, we copied the subdomain and next we need to configure it into the tunnel.

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

Log in to the cpolar web ui management interface and click on the left dashboard of theTunnel Management——Tunnel Listto find the tunnel that needs to be configured with a second-level subdomain, click on the right side of thecompiler

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

Modify the tunnel information to configure the second-level subdomain into the tunnel:

  • Domain name type: change to selectsecond-level subdomain
  • Sub Domain: Fill in the second-level sub domain we just reserved (in this case, themywebsitetest

When the modification is complete, clickupdate

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

After the tunnel has been successfully updated, click on the left dashboard’sstate of affairs——Online Tunnel ListYou can see that the tunnel’s public address has been updated to a second-level subdomain.

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

fixed after we use a fixed public address, open in the browser, you can see the apache default page, so a fixed public address access is set up!

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

5. Add site

above we visit the page is the default page apache, not the page we want, we can put their favorite page up, into the apache htdocs folder

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell"><span style="color:#e6db74">cd</span> <span style="color:#f8f8f2">$PREFIX</span>/share/apache2/default-site/htdocs
</code></span></span></span></span>

Installation of download toolswget

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell">pkg <span style="color:#e6db74">install</span> <span style="color:#e6db74">wget</span>
</code></span></span></span></span>

Here is a demo, we download a test site

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell"><span style="color:#e6db74">wget</span> https://www.cpolar.com/static/downloads/meditation-app-master.tar.gz
</code></span></span></span></span>

Download and unzip

<span style="color:#444444"><span style="background-color:#ffffff"><span style="background-color:#272822"><span style="color:#f8f8f2"><code class="language-shell"><span style="color:#e6db74">tar</span> xzf meditation-app-master.tar.gz
</code></span></span></span></span>

Then we type in our public address plus the path to the resource in the browser above./meditation-app-master/index.htmlThen you can see our personal site.

Now as long as we keep the tunnel online, public users can access our web site on termux from this fixed public address.

[Public Network Remote Mobile Android Server] Android Termux Build Web Server

Recommended Today

vivado Error Summary 1 — WARING:[Labtools 27-3361] the debug hub core was not detected make sure the clock

I can’t open the debug screen of debug after program device, I get the following error: WARING:[Labtools 27-3361] the debug hub core was not detected make sure the clock connected to the debug hub core is a free running clock and is active make sure the BSCAN_SWITCE_USER_MASK device property in vivado hardware manager reflects the […]