How to Set Up a Local Web Server on Android

How to Setup a Local Web Server on Android

As web developers, we often find the need to debug and test our websites or applications on the go and need to add a bit of flexibility to our workflow that will increase productivity.

If you fancy running a web server right from your Android device, you should definitely take a look at the KSWEB web server for Android.

It includes:

  • lighttpd server v1.4.35 (SSL)
  • nginx v1.7.3 (SSL)
  • PHP v5.6.2 (SSL)
  • MySQL v5.6.19
  • msmtp v1.4.32
  • Web Interface v1.2

ksweb-google-play

Head over to Google Play Store and KSWEB. It offers a six-day trial so you can test its features after which you will be prompted to purchase the application for $2.99.

Once you launch the application, the server is started, and you can navigate to “localhost:8080” on your Android device browser or the IP Address provided by KSWEB on your external machine. However, at this point you will only see KSWEB’s default home page.

ksweb-localhost:8080

The default username and password combination is “admin” and “admin.” It is recommended that you change the password for security reasons, and you can do so by heading to the KSWEB Web Interface at “127.0.0.1:8001” and entering the default login combination to access the admin area.

ksweb-admin-area

Once logged in, select System Settings and change the default password from “admin” to something else.

ksweb-change-password

ksweb-configure-phpmyadmin

Select the tools tab in the KSWEB, and install phpMyAdmin which is around 7MB. Once it’s done, you will be able to navigate to phpMyAdmin on 127.0.0.1:8000.

ksweb-phpmyadmin-login

To log in to phpMyAdmin, use “root” as the username, and leave the password blank. Once you’re in, it is recommended to change the password.

ksweb-phpmyadmin

The default root directory is hosted at “/mnt/sdcard/htdocs.” If you want to change this to some other location, perhaps on a micro SD Card, you can do so by selecting the Lighttpd tab and entering the file path you want.

ksweb-add-host

You can also add multiple hosts if you wish to run more than one website on your Android server.

ksweb-install-wordpress

If you’re a WordPress developer, and you want to host a test website on your Android device, you can easily do so with KSWEB. Just follow the following steps:

1. Start the KSWEB server (by launching the application).

2. Download the WordPress zip file from WordPress.org.

3. Extract the file to “/mnt/sdcard/htdocs” or the root directory you’ve specified using ES File Explorer or any other third-party tool.

4. Go to phpMyAdmin and create a database for the installation.

5. Visit your WordPress installation page at “http://localhost:8080/wordpress” on your device.

6. Install WordPress as usual.

Having the KSWEB server installed on your Android device is all you need to debug websites, run scripts or perhaps show a client a site under development without having online hosting.

You can also install your favorite tools, frameworks or CMS, such as WordPress, Drupal, Joomla and more through much the same process as highlighted above.

Have you used KSWEB? What’s your setup like? Share your thoughts in the comments section below.

17 comments

  1. As an IT and web developer of some 22 years I find the idea of setting up and running a web server on an Android device to be nothing short of totally retarded and completely ignorant of understanding the security implications that go along with such a ridiculous idea!

    • I see nothing wrong with it. If you want to have a local copy of your work wherever you go or just maybe only a few people need access to the website then it could come really handy. Whatever you say, some people will find this useful for them.

    • I think you are the retarded one if you think this will be accessible from outside of your own Lan without port forwarding, you sure you have been a IT web developer for 22 years

      • Seriously Scott? You really think you are somehow secure behind your local hardware firewall? What the hell does port forwarding have to do with any of this anyway? Port forwarding is something you do to get your Xbox to work and has squat to do with localhost. Ever heard of DNS and BIND? Maybe you should read up on it before spouting crap you are clueless about!

        • You ever hear about NAT cause your phone is behind at least 1 more than likely doubler NAT good luck with that when you have no control over the route

          • Only a fool would think you are somehow secure no matter what technology is in play! FYI, I have full control over my router and the fact is unless you are hardwired in you have no security from prying eyes other than encryption. That all takes place before the router ever comes into play! Beside the fact that you are arguing about something that is completely abstract from what I am trying to say. It is hard to argue with you since you are not even talking about the same thing!

    • I doubt if you are a developer for 22 years because if you were why would you say such a ignorant thing

    • Hey Kevin,

      As as developer that (admittedly) knows nothing about networking, I find your comments alarming (from a professional context).

      For me, I’ve been searching for the holy grail for mobile setups. I have a laptop for my main dev work but I don’t like having to carry it around when traveling, due to it being expensive, and also the bulk & weight.

      I’ve considered getting an Android tablet so I can do light dev work, check and merge other’s work, and push the commits back to our master repo.

      Having a full stack on a tablet and being able to work without an internet connection seems like a god send, especially on a light weight, cheap throw a way device that don’t have to really work about.

      What exactly would the issues be with this mobile setup vs a normal laptop? I would stop all the servers when I’m not developing.

      Or was your comment about the operational side of running a web server off your phone, which I can see some issues there.

      J

  2. I find this interesting. I will try it out on an older Android tablet I have laying around and see. In fact, if it installs and I can actually create a website, I’ll run some vulnerability tests against it and see.

      • Ayo, RU means Russia. They are quite well known for Spyware, hacking, and other illicit activities. Not saying this software has problems, just be vigilant.

        • Thanks for the clarification. Well I have been using Ksweb for a couple of months without any issues at all. Be good to keep that in mind though

  3. Leave a commentsurelly the app is good,i have been using it too for months but i will keep in mind what mr kevin m has pointef out

Comments are closed.

Sponsored Stories