Are you looking to run a simple web server off your iPad or iPhone? If yes, then you are at the right place. All you need to run a simple web server from an iPad or iPhone is a simple iSH Linux shell running on iOS. As long as you have the iSH Linux shell up and running, you won’t any issues in running the web server.
Simply by running iSH Linux shell and starting a web server with python 3, you can serve responsive or static HTML files or a folder listing to the same device through a localhost. Not only that, you can also serve users who are on the same network as you using the iOS devices IP address.
Obviously, this is not going to be fully functional. It also can’t be compared to technologies like Apache and Nginx. A web server based of on an iPad or iPhone is not powerful enough to handle projects which require enormous resources. But if you simply want to play around with a simple local HTML development environment or you’d like to save something from the iPad or the iPhone, this might just work.
How to run a web Server on iPad & iPhone with iSH and Python
The simplest way to install iSH is through TestFlight, but you can also side load the app using a Mac & Xcode. The testflight method is pretty simple compared to sideloading. To install iSH Linux Shell, follow below method:
Step 1. From the iPad or iPhone, install TestFlight from the App Store.
Step 2. From the iPad or iPhone, click the following link: https://testflight.apple.com/join/97i7KM8O
Step 3. Choose to start testing, and accept the TestFlight Terms
Step 4. Click “Install” in TestFlight, this will install the iSH Shell application into iOS.
Step 5. After installing iSH Linux shell on the iPhone or the iPad, open it.
Step 6. When the iSH command line opens, in the command line enter the following syntax.
Step 7. Press return. You will see the ‘Serving HTTP on 0.0.0.0 port 8000’ message.
Step 8. This implies that now you can connect to the server either from the same device or any other device on the same network.
How to view the Web server via IP
To connect the iOS web server from the same device (local host), point the web browser to:
To connect the iOS web server from another device on the same network, point the web browser to:
You need to replace “Device-IP” with the IP address of the device that is running the iSH Linux shell and Python web server. You can easily locate the IP address of the device by going to the Network Settings.
While you are working on it, it’s a good idea to throw in a basic HTML file in the current directory of your webserver. Once your web server is up and running, this will help you determine easily whether it is functioning properly and if the files on your web server can accessed by users on the network.
Please take a note here that in this tutorial the Python 3 web server is being worked with. You could also choose to use the Python 2 instant web server if you prefer, since both Python 2 and Python 3 are also available on iSH now.
Anyway, while there is not a solution that is in particular, practical to web hosting or web development and you most likely will not be using this for anything too serious or for any earnest immediate need, it is still ruled out to be a fun and quite interesting as a proof of concept for most of us geeky and nerdy people.
Who knows, maybe one fine day we will get better and easier web server setups in the iOS world like MAMP for the Mac, but until then, the solutions to running a webserver on iOS are extremely limited and most freelancers and web developers will continue to be using iSH to connect to web servers for the time being.
There are several other ways that you could use to run a web server on an iPhone or an iPad. If you want to try, here are another few simple methods.
Accessing local host from the iPhone usually will do a loopback or will try to connect to itself only if it supports that.
You will need to find the IP of your desktop machine (for example: if Windows, go to the Command Prompt and type ipconfig or go to Network and Sharing Centre and look up connection status.
Once you have your IP address, simply type it in the URL bar of your web browser and hit Enter.
You may have to open up port 80 (or whatever port your website would be currently running on) in the inbound security of your firewall if you are running one.
If you are using a Mac, you could go to System Preference > Network and use your IP address instead of using a localhost. Remember, you also need a port number. For example, you could have a server running on port 1448 and you could preview 192.168.1.241:1148 using the iPhone.
Or, you could even try another method:
- Open Command Prompt with administrative privileges.
- Run ipconfig (Old) ifconfig (New) commands in the command line window.
- Check your Wireless Network card IP
- Go to iPhone and navigate to “http://xxx.xxx.xxx.xxx/” through your browser.
(xxx.xxx.xxx.xxx is your IP)
Note: If you are running behind a Firewall, you will need to open ports and whitelist IP addresses.
With that, we now know how to run a web server on an iPhone or an iPad with ease. They may be several new ways, but that is the way of technology as it is always developing and several new ways always seem to crop up. For now, this is a simple and easy procedure to implement.
Can you please send me a video of how tor run HTML codes on ish