How to Run a Simple Web Server on iPad or iPhone

Feb 20, 2019 - 15 Comments

Simple web server running on iPad or iPhone

Want to run a simple web server off of an iPad or iPhone? If you have iSH linux shell running in iOS then you can easily start and run a simple web server directly from an iPhone or iPad. By running iSH and starting a web server with python 3 you can then serve either HTML files or a directory listing to the same device via localhost, or to anyone on the same network with the iOS devices IP address. This is obviously not going to be as fully functional or featured as running apache or nginx, but if you want to geek around with a simple local html development environment or serve something via http from an iPhone or iPad, it’ll do the trick. Plus, it’s just plain cool.

How to Run a Web Server on iOS with iSH and python

  1. Install iSH on the iPhone or iPad as directed here if you haven’t done so already, otherwise launch iSH
  2. At the iSH command line in iOS, enter the following syntax and hit return:
  3. python3 -m http.server

  4. When you see the ‘Serving HTTP on port 8000’ message, now you’re ready to connect the web server from either the same device or another:
  5. Python simple web server running on iOS

    • To connect to the iOS web server from the same device (localhost), point any web browser to:
      Loading web server from localhost on iPad

    • To connect to the iOS web server from another device on the same network, point any web browser to:
    • http://DEVICE-IP-ADDRESS:8000
      Replacing ‘DEVICE-IP-ADDRESS’ with the IP address of the device running iSH and the python web server, you can find the iOS devices IP address in Network Settings if needed. (Example screenshot shows the iOS device IP of
      Loading the iOS web server from another iOS device on the same network

Pretty cool, right?

You’ll probably want to put some basic index.html file at the present working directory where you’re running the python server from. If you don’t have a simple index.html file in the current working directory on the iOS device where the python command is being run, then a simple directory listing is shown instead.

While the simple web server is running, you’ll see standard logging information appear in the iSH terminal window, showing access times, dates, IP addresses, GET and PUSH requests, 404 errors, and other typical access log information.

Simple web server on iOS showing access logs

We’re obviously going with the python3 web server command here, but you can also use the Python 2 instant web server if you’d prefer, since both python2 and python3 are available on iSH.

Anyway, while the isn’t a particularly practical solution to web hosting or web development and you likely won’t be using this for anything too serious, it’s still fun and interesting as a proof of concept for us geekier folks. Perhaps one day we’ll get some easy web server setup in the iOS world like MAMP for Mac, but until then the solutions are fairly limited and most web workers and developers will continue to be using ssh to connect to a web server for the time being.

If you know of any other interesting or geeky solutions for setting up a web server or web sharing natively with an iOS device, share with us in the comments!


Related articles:

Posted by: Paul Horowitz in Command Line, iPad, iPhone, Tips & Tricks


» Comments RSS Feed

  1. Matt says:

    Very cool! Thanks. One issue: the server (python3) is running on my iPad – because I can successfully access it from other household computers. However, I can’t access it from the iPad itself where it is running. < local host (iPad) < from other computers

  2. uran5000 says:

    How to do in other way? I put python server on PC and I want to download something from it into iPhone.
    cURL -O ? wget ?
    And where is home directories when using iSH or a-shell or other iOs terminal?
    Is it even possible?

  3. sophie says:

    Useless. Why? Because there is no Ctrl on the iOS keyboard, and your app does not provide a Ctrl key either.

    Great…. ^^

    • Arc says:

      For anyone that is stuck with this issue, the ctrl key access is provided by the second button in from the left on top row of the iSH keyboard, it looks likes a ^. To get for example ctrl+c to stop the webserver, all that has to be done is press that button and then c . This will do the same as pressing ctrl+c on a physical keyboard and stop the server.

      Hope this helps!

  4. Frey says:

    You have to instal Python3

    Apk add python3

    And then install the server

  5. Jack says:

    Unfortunately, when I ran python3 -m http.server I got a python3: not found message. Any thoughts?

  6. Yousef zalkha says:

    In order to access it from a WAN i believe that you should open the port in your home router, while it’s difficult to open the same port if you were on 3g/4g env.
    This is a fast comment as i’m searching for a solution to my problem
    Have a good day

  7. JD says:

    I’ve tested and it’s working fine when accessing the web server within LAN but not from WAN (Internet). What do I need to do in order to allow the web server to be access via WAN?

    Thank you for this tutorial.

  8. Andrej says:

    I like this a lot!

    Question 1: How safe is this? I would like to try this, but without someone getting access to my phone’s gallery, messages, email etc.

    Question 2: Would it be possible to put .jpg files stored on the same iphone on the website?

    Question 3: Could you host a custom domain name in this way?, instead of the ip

  9. Yeah, That Dude says:

    Withing 2 minutes of trying this, my IDS software picked up IP’s from Russia and China trying to hack it!

  10. Ceasar says:

    This is fascinating but what I would really like would be a full LAMP and LEMP setup contained within an app on iPad and iPhone. MAMP for Mac is similar.

  11. Michael Spencer says:

    Geekatude score? 10!

  12. Jack D says:

    WOW, this is very cool. Is there any way to link or access filed stored in icloud, google drive etc from the command line?

  13. Rick Rump says:

    Very cool! And ‘app add nano’ gets you and easier to use editor than ‘ed’.

    My iPad may now get more traffic than!! 🤡

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site