Skip to main content

Running a web server on my Android

I have never attempted this before. I was deciding on what to blog about today and it occured to me that this would be a fun project and blog post. The first thing I had to do was see what apps were available and I was looking for apps where I would not have to do any rooting of my android device.

I searched the play store for "web server", looking at number of installs for popular apps. Then for free options and then the reviews. No quick obvious option so now I turned to a google search for "android web server".

HTTP server powered by Apache seems like a popular and useful option but I get, your device is not compatible with this version in the play store. My mobile is a Samsung M30 running Android 10.

I also came across Tiny Web Server which I decided to try. It's simple but I can review other options in another blog post. Today I just want to get started. I installed the app and was greeted with the warning, "this app was built for an older version of Android and may not work properly. Try checking for updates or contact the developer."

I opened up my file manager app and created a folder called WEB and used that folder as the server path in the app. I then clicked on start server. I went over to the Chrome mobile brower and opened up url localhost to see what would happen. The browser returned, "This site can’t be reached localhost refused to connect. Try: Checking the connection ERR_CONNECTION_REFUSED". I then tried the ip address. Same thing. I then decided that I probably needed an index.html.

I then installed HTML editor by Subedi and created a simple index.html in the WEB folder. After a short while of trying I realised that you have to specify the complete URL with port and file name to see the web page. For me that was http://192.168.0.15:8080/index.html

Web server on Android


Then I tested if it could handle a javascript alert. It worked. What I realised now though, was that I had to restart the server whenever I made changes. Also, without specifying filename in url the server serves up a directory listing.

So that was my first and quick attempt at serving static website content from my android smartphone. In a future blog post I will look at doing more with this project like using the No-IP.com app to map ip address to a named url.

Comments

Popular posts from this blog

Below the surface

This is a chapter from my eleventh book called Quotation Marks Sparks . __________ "You can't stop the waves, but you can learn to surf." - Jon Kabat-Zinn __________ I was looking at quotes that hit hard and this quote stood out to me. It seems mundane and obvious and often repeated. Life is about how we respond to the inevitable. It is not what happens to us but how we respond. I had to ask myself to dig deeper and look below the surface. Then I saw that when we surf we really become the waves. We become friends with the waves. The waves and us are the same. Further, the waves are created by us and in our heads. We can control the waves because who can surf all the time? Sometimes we just have to come to shore and build sand castles on shore. I asked my friend Gemini for feedback and he said that I was right, the Jon Kabat-Zinn quote initially seems like a simple call for resilience, but my deeper dive reveals profound layers. The idea that we can move beyond merely rea...

Thankful

It is 617pm and I have decided to write. Right now I am thankful. The cool of the evening has replaced the heat of the day. I took a bath and changed and now I am just relaxing. Sometimes I complain. Not often. But I feel bad afterwards because there is so much to be thankful for. There is always room for improvement and we have to identify the things for improvement and change is often good but we do not have to make it into complaints. Yeah I get it. Life is hard and none of us has it easy. Look on the bright side of things. And sometimes it is the little things that remind us that life is good. Things that we take for granted. Like I was coming in the maxi taxi today and heard a gospel song that was about gratitude. God does appreciate a grateful heart. Trinidad and Tobago celebrated sixty four years of independence yesterday and if we stop and listen to the many complaints we would swear we are living in the worst country in the world. That is not the case. We do get a lot of thing...

Having a soft spirit

It is 137am. It started raining. I decided to write. I have heard about having a soft heart but what does it mean to have a soft spirit? And is having a soft heart related to having a soft spirit? My friend Chatty says that a soft heart feels deeply — it breaks, heals, and loves with tenderness — while a soft spirit moves gently through life, unresisting and at peace with what comes. The two are kin: a soft heart opens you to emotion, and a soft spirit teaches you to carry that emotion with grace. Together they make a person both tender and strong — able to feel the rain and still trust its rhythm. I like the quote, "a soft spirit in a hard world" by author and poet, butterflies rising. It resonates with how many of us feel. My friend Chatty tells me that that quote captures the quiet strength of staying gentle in a harsh world. It reflects the author's signature themes of vulnerability, tenderness, and emotional courage — the idea that softness is not weakness but a form...