How to Set Up 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.