How to Run Localhost on Android and install WordPress in it

How to Run Localhost on Android and Install WordPress in it

Do you know that you can run localhost on your Android device? Well, it’s very easy to run a local webserver on your android device using an app that you can download from the play store. 

So, in this post, we’ll see how we can run localhost on our Android device and also install WordPress on it. After setting this up, we will be able to access our webserver at “http://0.0.0.0:8080” and also be able to access our WordPress website.

Advertisement

To be able to run a localhost web server on our android device, we will use an app called “AWebServer”. This app is available on the play store and this app will help us make a local webserver on our device.

Install AWebServer App -

To begin, first, open your play store and then search for “AWebServer”. Install the app that’s developed by slykat.

Advertisement

Now open the AWebServer app. When you first open the app, the app will install its components which will take a little bit of time. After that, it will ask you for storage permissions, allow it.

After the app installation finishes, go to your file manager and create a new folder where our webserver files will be stored.

Create a New Folder -

Now after the installation of the app finishes we will have to create a local folder on our device where the webserver files will be stored.

Advertisement

First, open any file manager that you use, now once you are inside the file manager, go to internal storage.

Inside the internal storage create a new folder, I am using ES File Explorer so here are the steps –

  1. Open ES File Explorer and then go to Internal Storage. 
  2. Here click on the three dots at the top right corner. Click on “+ New” then select Folder.
  3. Enter the folder name as “www” then click on “OK”. The folder will be now created.

Now follow the rest of the steps below to finish setting up the AWebServer App.

Advertisement

Change Root Folder -

Now that we have installed the AWebServer app and also created a new folder for it, we’ll need to change the Document root address to the new folder instead of the default one, so that we can easily add and remove files from our local web server.

First, open the web server app and then click on the Document Root “Select” option. Now select “Internal” then click on OK.

change root folder of awebserver app

Here select the www folder that you created and then click on the “SELECT” button. 

That’s it. The app setup is now complete and you can now start the webserver. 

Advertisement

Start the Local Web Server -

After installing and finishing the setup of the AWebServer app, to start the web server all we have to do is to click on the “Start” button at the right side of Service.

After the web server starts, you can access the server by going to the HTTP address shown at the top. It will be like – “http://0.0.0.0:8080”.

starting local webserver in awebserver app

Now, by default, there will be nothing in that address and you will only see the index of the files inside the “www” folder that you created. So, let’s create an index.html file for the root address.

Advertisement

Create an Index.html File for Root -

Open the ES File Explorer then go to Internal Storage. Now scroll down and go inside the “www” folder that you created.

Once you are inside the www folder click on the three dots at the top right corner. Then click on “+ New” and select File.

Name the file “index.html” and then click on OK. After creating the index.html file click on it. 

Here you will have lots of options to select from, but what you need to select is “ES Note Editor” and then click on “This Time Only”. After the file opens, click on the Edit button at the top bar.

open index file using es note editor
Advertisement

Then copy-paste the HTML code from below or add your own HTML code.

<html>
    <head>
        <title>
    HOME
        </title>
    </head>
</body>
    HOME
</body>
<html>

After pasting the HTML code click on the Save button at the top.

Now if you access the webserver by going to http://0.0.0.0:8080 you’ll see that it has changed to what you added to your index file.

Advertisement

Okay, so that’s how you can run a localhost web server on your android device easily. Continue reading below if you want to know how you can host WordPress in a localhost web server on android.

Install and Setup WordPress on Localhost Android -

Okay, so now that we have completed the setup of the local web server, let’s install WordPress on it.

To install WordPress on localhost on our android device we will first have to download WordPress from the official website of WordPress, which is wordpress.org. Go to this website and click on “Get WordPress”.

Advertisement

Scroll down a little and then click on the “Download WordPress” button. After the download finishes, open ES File Explorer. Go to Internal Storage then inside the downloads folder.

Now click on the downloaded wordpress.zip file and then open it using ES Zip Viewer. Go inside the WordPress folder and long-press one folder. After that, you will get the option to “select all” at the top. Click that and select all.

select all the files inside wordpress zip folder

Now click on the Extract option at the bottom. And then select the “Choose Path” option. After that click on the /sdcard/ and select the “www” folder, then click on OK twice.

Advertisement

Wait for the extraction to complete. After the WordPress file extraction finishes go to the www folder and there will be a new folder called “WordPress”. Go inside the WordPress folder and select all the files inside of it. Then move all the files from /www/wordpress/ to just the “www” folder. 

Make sure to delete the index.html file that we created in the www folder.

Now open the AWebServer app.

Here in the app go to the MySql option and then click on the start button. 

Now, open your browser and go to “http://0.0.0.0:8080/mysqladmin/”. Here login to your PHPMyAdmin dashboard by entering your password and username. The default username and password for PHPMyAdmin is “root”.

Advertisement

After logging in to your PHPMyAdmin click on the Databases option at the top. Now in “database name” type the name as “website” which will be the database name. Just below the database name select the language. Click on the dropdown and then look for “utf8_general_ci” and select it, then click on create.

create-a-new-database-in-awebserver-app

After creating the database go to http://0.0.0.0:8080/wp-admin/, here follow the WordPress instructions to complete the installation of WordPress on localhost in android.

The database name will be “website”, password and username will be “root” and the Database Host will be 0.0.0.0:3306

Advertisement

After following all the steps your website will be available at – “0.0.0.0:8080” and its admin dashboard will be available at “0.0.0.0:8080/wp-admin”.

And that is how you can run localhost on android and also install WordPress on it. The steps are easy and you can easily follow them. If you liked this post and this post helped you in any way, then make sure to comment below and also share it with your friends. Thank You.

Leave a Comment

Your email address will not be published. Required fields are marked *