How to setup a website using Termux?

Hey Guys,

This is Zaeem, Today we gonna see how to set up a static website on Termux, If You have Knowledge of PHP, HTML, CSS, and JS you can easily make your website but are worried about Hosting and you are here for something like FREE, So without wasting time Let's Begin...

how to setup a website using Termux

Here I am Assuming That you had made a simple website whose files are:

• index.html

• style.css

Things you need:

• Termux (Download it from Google Play Store)

• Ngrok Account 

• Apache webserver (This we will setup inside of termux)

Termux Setup:

πŸ‘‰ apt update && apt upgrade

πŸ‘‰ apt install zip wget -y

πŸ‘‰ apt install php -y

πŸ‘‰ apt install apache2

Apache Setup:

πŸ‘‰ rm /usr/share/apache2/default-site/htdocs/index.html  (it will remove default HTML page)

πŸ‘‰ cd

πŸ‘‰ cd /sdcard/yourwebsitefolder/

πŸ‘‰ ls 

πŸ‘‰ mv index.html style.css /usr/share/apache2/default-site/htdocs/

πŸ‘‰ apachectl 

Note:- if you have a php website then you have to use a PHP server

Now type a http://localhost:8080/index.html

Your website will appear but it is in your local network, Now we will configure to over a WAN

Ngrok Setup:

πŸ‘‰ cd

πŸ‘‰ wget

πŸ‘‰ unzip

πŸ‘‰ chmod +x ngrok

πŸ‘‰ ./ngrok authtoken YOUR_TOKEN

πŸ‘‰ ./ngrok http 8080

you will get a random domain that is accessible over WAN, if you want to change it you have to connect your custom domain...

Advantage of Setting Up Website in Termux:

• Reliable easy to access all files 

• No need To Purchase any hosting

Disadvantage of Setting up Website in Termux:

You have to make Termux to be run in the background 

• If your device will turn off your website will be Down

Thanks for visiting My Website...

Post a Comment