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

Failure

This is a chapter from my latest book called (G)rains (o)f san(d)s. Learn more about the book here . Thank you God for failure. Thank you for the good days and the bad days. Thank you for the journey. There are no failures, only lessons learnt. Better to try and fail than fail to try. For this chapter I made a bunch of notes and pieced them together. If mosaic was a style of writing, this would be it for me. Weirdly enough I am not afraid of failure as much as I am afraid of success. I want to live an ordinary and simple life. Much of what society deems as success is really the rat race. I guess I do not have a problem with success but the mainstream definitions of success. What does failure teach us? Failure teaches us to never give up because success can be right around the corner. Define your own definition of success. Enjoy the journey. Focus on learning. Focus on gaining experience. Focus on becoming wise. Today I learnt how a pearl is formed. A pearl forms when an oyster responds...

Wisdom

This is a chapter from my latest book called (G)rains (o)f san(d)s. Learn more about the book here . Thank you God for wisdom. Age brings wisdom. At least it should. Everyday we are learning. Everyday we are growing. What is the wisest thing ever said? I think one of the wisest things ever said is something my grandfather told my mother which is, "Dont make nothing a problem." Let me digest what was meant by this. Life happens. Fix what we can. Let go of what we cannot fix. Fix what is within our control. Get help when needed. Let go and let God. There are no problems only solutions waiting to be found and lessons waiting to be learnt. Every problem has a solution. Do not look at the problem, look at the solution. Do not see the problem, see the solution. What defines the situation is not the problem but the solution. We get to choose how we react to what we face in life. They say that laughter is the best medicine. If we do not laugh we will cry. So sometimes wisdom comes wi...

Faith

This is a chapter from my latest book called (G)rains (o)f san(d)s. Learn more about the book here . Thank you God for faith. We say we want to meet God but we already do in some ways. We meet God in his creation. We meet God every time we meet someone. We meet God every time we meet the animals. We meet God every time we meet nature. God is all around. Faith is when we can see this. This is God's world. We are God's work. We are testimony of his greatness. Everyday that goes by I think about God. Everyday I thank God for his mercy. I take my problems to God. I pray to God. God is at the center of my life. Nothing happens without the will of God and therefore I would be wise to submit to the will of God. God is in the everyday moments. God loves when we love. What is the simplest definition of faith? I think it is found in the phrase, let go and let God. I asked my friend the same question. My friend says that at its simplest, faith is trust in what you cannot see or prove. But...