Ever thought of creating your own website and hosting it with your android phone? Well its kinda easy to do so with the help of a few apps. So, let’s get into it.
Apps you need
- A text editor for writing HTML, CSS, JS etc. (I prefer QuickEdit)
- A web server app for hosting your site (I prefer HTTP server powered by Apache)
- Termux app or Page kite app (will describe about that below)
Let’s get started!!
OK first things first, what is your website about? If its a marketing website, then hosting with android might not be the best idea (sorry about that) cause tons of clients will be surfing your web, which definitely needs a system with good processor and ram of course.
If its a text based simple website, then you’re in luck.
Assuming that you’ve created HTML/HTM pages of your website, now you need is a server app. I would suggest HTTP server powered by Apache because I loved using it and its simple for beginners and advanced for intermediates or experts (because of its various custom modules). Now after downloading the Apache server app, launch it and tap on the latest version which is usually at the top of the options and wait for it to complete its installation.
Now open your file manager/file explorer app and you’ll see that there’s a new folder named htdocs. That’s the folder created by the server app, and once you’re inside that folder you’d have to navigate to another folder called public. The public folder is where you keep all your webpages (HTML/HTM files). Now once you’re inside, you’ll see that there’s a file named index.html already there. As you know the first introductory page a website displays is fetching the contents from index.html, so its basically the first page that’s being displayed when a visitor visits your site.
Now you need a domain name, oh before that you can test the server if its working or not. To do that, go the the server app and press launch server button and copy the link for eg. 0.0.0.0:8888 or something like that.
That’s the I.P. address of your system copy that and paste it to your browser and you’ll see the first page of your website in your browser.
Now you need a domain name of your site for eg. mywebsite.serveo.net or mywebsite.pagekite.me.
You might be thinking why not mywebsite.com or mywebsite.org or etc. Here’s why;
Hence comes the apps Termux and pagekite.
Hosting with serveo.net
Serveo is an SSH server just for remote port forwarding. When a user connects to Serveo, they get a public URL that anybody can use to connect to their localhost server.
First you’ll need the termux app. Download it and open it, now once inside type the following code:
pkg install openssh
Then you’ll need autossh, so for that you you’ll need to install autossh package; just type “pkg install autossh” in the terminal screen.
The final command you’ll need to execute in the terminal window is this
“autossh -M 0 -R mywebsite.serveo.net:80:localhost:8000 serveo.net”
Termux is a terminal emulator and with ssh to serveo.net it can open a tunnel and host your website over the net. Here, you can replace mywebsite with your desired name. Here 8888 is the port number, you can change it to 8000 or any other number, but remember that the port number must be as same as that of the port number of the HTTP server app. Now with all being set up head over to your browser and enter your address mywebsite.serveo.net and voila there you have it.
And its available to all of the people around the world. Oh and have I mentioned that its completely free!!
More at serveo.net
Hosting with Pagekite
OK first you need the pagekite app, download it from the link given above or you can download it from this link directly. First you need to create an account on pagekite.
Then using your account information you have to login on the app.
Once in, click on fly kite and that’s it.
Oh and you need to set up the port number same as the http server port number. The thing with pagekite is that its free for the first month, but then you’ll have to pay $3 USD to continue flying your site. With that being said, pagekite provides a better security so yep.