How to Run a Web Server on Your Android Device

  • MORE

android server how to sf

Whether you have a $50 mini PC that you leave plugged in all the time or a 5-inch smartphone that you carry with you, you can use any Android device as a full fledged web server that's accessible either on LAN or from anywhere on the Internet. With an Android web server, developers can easily test their code without paying for a hosting service. Freelancers can carry a copy of the web tools they've built with them to show their clients. Home and small office users can even set up custom web tools for users on the local network.

Here's how to set up a web server on your Android phone, tablet or mini PC.

Install the Web Server

1. Install and launch KSWEB on your Android device. The app only has a six-day free trial, after which it costs $2.99. There are a number of other web server apps, including Bit Web ($2.39) and Servers Ultimate, but we chose KSWEB for this tutorial because it is one of the simpler options.


 2. Navigate to the IP address listed by KSWEB in your computer's browser or to localhost:8080 on the device itself.

ksweb ip

3. Click the link for KSWeb Interface and enter the default username and password (admin and admin).

ksweb admin

4. Select System settings and change the default password from "admin" to something else.

kweb change admin password

5. Select KSWEB settings, enter a MySQL shell password and hit save. You can stick with the default, blank password but it is unadvisable to have a blank password, even if your server isn't connected to the Internet.

ksweb mysql pwd

6. Select a root directory for your site by tapping Document Root in the KSWEB app's settings menu and entering the appropriate file path. You may wish to keep the default directory (/mnt/sdcard/htdocs), but we recommend that you save space by putting the folder on a microSD card, if your Android device has one.

ksweb settings document roo

You can now visit your site by navigating to localhost:8080 on the Android device or by navigating to the IP address displayed by KSWeb. However, at this point, you will only see KSWEB's default home page and you will only be able to access it from within the local network. 

MORE: Galaxy S4 Tips

Make Your Server Accessible From the Web

If you want users outside of your local network to see your web server, you must make a few tweaks to your router settings. Every brand of router has its own administration menus so the names of menus and fields will vary slightly, but these are the general steps you must take to make your Android web server available on the Internet. Our screen shots and menus were taken from a TRENDnet TEW-633GR router.

1. Log into your router's administration page from your PC. If you don't know its IP address, check the user's manual for your router.

router admin

2. Make a static IP address available for your Android device. Local IP addresses tend to start with and go up from there. If your router provides DHCP (dynamically assigned I IPs) to an address range, anything lower than that range will be available for a static assignment. For example, our router uses addresses to for dynamic assignments so we chose to give our phone the address. Some routers will also let you reserve a specific address.

dhcp server settings

3. Configure your router to forward port 80 to port 8080 on the static IP address you're assigning to your Android device. On our router, this function was labeled "Add virtual server" but on others it will called "port forwarding."

port forwarding settings

4. Navigate to the Wi-Fi menu on your Android device.

select wifi settings

5. Long press the name of your Wi-Fi network and select Modify Network.

wifi settings modify networ

6. Check show advanced options.

wifi settings show advanced

7. Select Static under IP settings and enter the static IP address you chose (or reserved) and tap Save.

wifi settings static ip

8. Search Google for the term "What's My IP" to find your router's public IP address. Google will display it above the search results.

find public ip

Anyone on the Internet will now be able to navigate to your site, as long as you give them this IP address to use. Unfortunately, unless you pay for a plan with a static IP address, your number could change the next time your router reboots. You can solve this problem by purchasing a domain and using a dynamic DNS service such as that always directs that domain to your current IP address, no matter how often it changes.

Keep in mind that hosting a web site from your home Internet connection may violate your ISP's terms of service so, if you're planning to have everyone on the Internet visiting, you may want to upgrade your account or purchase a web hosting package.

MORE: 5 Ways to Speed Up Your Android Phone in Under 5 Minutes

Keep Your Web Server Awake

When your Android device goes to sleep, the server software goes to sleep also so users will not be able to connect to it. There are a number of apps that will keep your device from sleeping, but we like Keep Screen On because it allows you to decide which apps will keep the screen awake and to set the device not to sleep while charging. 

To keep your Android device awake while the server is on:

1. Install Keep Screen On.

keep screen on

2. Toggle the service to On and tap settings.

keep screen on toggle on

3. Toggle Keep screen on while charging to on. If you plan to keep your server up and running, you should leave your device plugged in anyway.

keep screen on settings

4. Tap Applications. A list of all applications appears.

keep screen on settings men

5. Check the box next to KSWEB and tap the light bulb icon in the upper right corner of the screen. 

keep screen on applications

6. Select "When app is running" from the pop-up menu that appears.

keep screen on running

MORE: 30 Apps for Rooted Android Phones

Adding Files to Your Android Web Server

With KWSWEB running, you browse your site directly from the Android device by navigating to localhost:8080 or you can visit its IP address from any computer on your local network. However, there's no point in visiting a site that has no content. If you want to put HTML files, PHP scripts, images or other files on your server, you can either create them locally or send them from your PC via FTP. 

To edit Android Web server files locally:

1. Install DroidEdit or another code editor on your Android device.


2. Write or edit web files in HTML, CSS, PHP, Javascript or other languages.

3. Save files to the web server's directory by selecting Save as and navigating to the appropriate folder.

save file

To send files to your server over FTP:

1. Install FTP Server by Olive Tree.

ftp server google play

2. Tap Home directory in FTP Server's settings menu and select Custom folder.

ftp server set custom folde

3. Tap Custom folder in the settings menu and enter the KSWEB's root directory (/mnt/sdcard/htdocs if you didn't change it).

ftp server custom folder 670x369

4. Set a username and password by tapping on those options in settings.

ftp server set username pas

5. Tap the start button in FTP server. If the server is active the button will turn green after you tap it. You can tap it again to turn FTP off.

start ftp server

6. Forward port 21 to port 2221 on your Android device's IP address in your router software if you want to FTP from outside of your local network.

ftp port forwrading

Users will now be able to upload and download files from your web server by entering either the local or public IP addresses into an FTP client such as Filezilla.

MORE: Best Android Security Apps 2013

Install Wordpress On Your Android Server

With PHP and MySQL on your server, you can install any of a number of content management systems (CMSes), including Wordpress, a very powerful publishing tool used by over 8.5 million sites including several large ones. To install Wordpress on your Android server:

1. Install Astro File Manager if you don't already have it.

2. Download the Wordpress zip file from

wordpress download

3. Launch Astro File Manager and navigate to the Download folder (usually under /sdcard/Download) on your device.

4. Long press the wordpress zip file and select Extract Here.

astrofile extract

5. Copy the wordpress folder under Download and then paste it into the server's root directory.

astro copy

6. Navigate to the device's local IP address at port 10,000 on your PC. PhpMyAdmin will load.

phpmyadmin ip

7. Enter the root as the username and the password that you assigned to it when configured KSWEB.

phpmyadmin log

8. Click the Databases tab at the top of the screen.

databases tab

9. Enter "wordpress" in the Create database field and tap Create.

create wordpress db

10. Navigate to your server's IP address with the port :8080 and path /wp-admin/install.php (ex: on your PC.

11. Click Create a Configuration File when prompted

wordpress config


12. Enter your database user name and password when prompted by Wordpress.

wordpress username password

13. Click Run the Install when asked by Wordpress to do so.

wordpress run the install

14. Enter your site title, desired username, password and email address then hit the Install Wordpress button. These are the credentials you will use to log into Wordpress after it installs.

wordpress username

Wordpress will then confirm your install and allow you to log in for the first time.

wordpress install confirmed

You will be able to log into Wordpress and write new posts by going to your IP address /wordpress/wp-admin.

Author Bio
Avram Piltch
Avram Piltch, LAPTOP Online Editorial Director
The official Geeks Geek, as his weekly column is titled, Avram Piltch has guided the editorial and production of since 2007. With his technical knowledge and passion for testing, Avram programmed several of LAPTOP's real-world benchmarks, including the LAPTOP Battery Test. He holds a master’s degree in English from NYU.
Avram Piltch, LAPTOP Online Editorial Director on
Add a comment
  • Oded samuel Says:

    Hi. Thanks.
    But, what if i want this to run over cellular data , can i still portforward to my cellular suppose i overcome the frequent ip changing ,and movement amongst cellular towers by ddns. Can i ?


  • Shivam Says:

    How can I use the domain name instead of the ip address??
    Like if I buy domain name from and want to use it then what should I do in the given process?

  • Roxymarquiso Says:

    Sir, Video tutorial. .

  • Roxymarquiso Says:

    Sir have any tutorial about Android webserver?

  • Jose Manuel Says:

    Is it possible to run with KSWEB multiple domains at the same time? And it is also possible to run multiple WordPress installations, one for each domain?

  • mostafa Says:

    How to change «localhost:8080» to «localhost» in ksweb
    2:where is httpd.con in ksweb , I want to Change «localhost» address to
    3:I work on a zend project pls help me. I want to use my end project in ksweb

  • Naqash Abdul Sattar Says:

    Great Tutorial, please explain how to virtual host a domain name ( on this server?

  • N.Saravanan Says:

    wonderful blog!!!, hand held server amazing, Thanks

  • Ello Oku Says:

    Nice Blogging. I want to share my experience based on the problem I encounter on the latest WordPress. Don't use your local IP address or localhost while installing WordPress because access your site from a public IP address will return a fault. Only the index.php will load while other pages will return "localhost:8080/?=p1. I solved it by Installing WordPress from a public IP address.

  • Robert treboR Says:

    The article is pretty good, but it doesn't appear to what I was hoping it would do:

    Can my tablet be a host and ALSO be the hotspot?

    I am looking to put webpages and images on my tablet, and was hoping that other people on the bus I will be riding (without internet) would be able to access my web pages (files on the tablet).

    I'm not sure what I'd even call such an arrangement.

    Thanks - bob

  • Vishnu Says:

    This is awesome..! Handheld server..

  • IDR Says:

    @Giancarlo, incoming traffic needs to know which computer/device in your network is your site hosted on. Port 80 is the default web-server port, therefore, needs to be forwarded to your device's local IP, which is done by your router.

  • Giancarlo Says:

    Hi Avram,
    first of alla thanks for this page, very clear, detailed and full of images.
    I have only a question: it is not clear to me why I need to change the router settings. My need it to host my little web site directly on my mobile, and I want it always up and running, so why I need to deal with my router?
    Thanks for your reply.
    Giancarlo from Italy

  • Eduard Says:

    Hi, nice tutorial! Very helpfull!

    Got the server running on my Nexus 4, but there is something I can't figure out..
    I want to use my Nexus 4 as web server AND wifi hotspot at locations where there is no wifi (or even 3g), but I can't figure out how to connect to the webserver root from another device. I can set up the wifi hotspot and connect with it with another device, but then I don't know how to get to the server. Any ideas?

  • DH Says:

    This is great tutorials.
    Thanks a lot.

Back to top