Have you ever wanted to create your own portable server? Whether you’re learning web development and want to host your own HTML files on your iPhone, or whether you just want to play around with a server without being restricted to using a laptop or a computer to install MAMP, your iPhone can do it for you. So, if this is something you’re interested in, we’ve got you covered with all the important information you’ll need. Here is how you can run a simple web server on iPhone.
Run a Simple Web Server on iPhone and iPad
Running a server on your iPhone isn’t a difficult job at all. In fact, it’s really quite straightforward. All you need is a simple, free app, and that’s pretty much it. Obviously, since this is a simple web server, it won’t have all the bells and whistles you’ll get with something like a XAMP or MAMP installation on your laptop or PC. However, it can do the basics and do it well. So, let’s jump right in.
As always, you can use the table of contents below to navigate through this article.
Requirements for Running a Web Server on iPhone
Apart from an iPhone, all you need to run a web server, is a Linux shell environment. There are a couple you can use, but we are going to use the iSH Shell app (free).
Create a Simple Web Server on iPhone with iSH Shell
- First, install the iSH Shell app (free) on your iPhone and launch the app.
- Now, we will install Python 3 on the iPhone via the shell. Just type in the command mentioned below.
apk add python3
- Once Python 3 is installed on your iPhone, you’re ready to create the server. Enter the command given below to start a web server on your iPhone.
python3 -m http.server
- Next, you should see the “Serving HTTP on 0.0.0.0 port 8000” message at the bottom. Besides, you will also get a popup saying something like, “iSH would like to find and connect to devices on your local network. This is required for connecting to localhost and using the ping command” Tap OK in the popup menu to proceed.
- Next up, you can connect the web server from either the same device or another. If you want to connect to the iOS/iPadOS web server from the same device (localhost), just point any web browser to the following address.
- In order to connect to the iOS/iPadOS web server from another device on the same network, point any web server to the below address.
Note: In the command above, you will have to replace “device-ip-address” with the IP address of your iPhone. You can find your iPhone’s IP address by heading to Settings -> WiFi -> Tap on your WiFi name -> IP Address.
How to Add Your HTML Files to Your iPhone Server
Now that we’ve created a server, you may be wondering where and how to add your HTML files, right? Well that’s easy as well. Just follow the steps below.
Note: We are assuming you already have created…
Read Full Story At: Beebom.