DEV Community

imranalam21510
imranalam21510

Posted on

How to use LocalXpose with a Localhost WordPress

Are you working on a WordPress site on the localhost and want to share it with others? Or maybe you want to test how your site would work if it was live on the internet. LocalXpose can help with that! In this article, we'll show you how to set up a simple WordPress site on the localhost and then use LocalXpose to expose it to the internet.

What is LocalXpose?

LocalXpose is a reverse proxy that enables you to expose your localhost to the internet. It is useful for developers who want to share their localhost with others, or for anyone who wants to access their localhost from a remote location. LocalXpose has many useful features, some of them are:

  • Multi Protocols and Regions: Nowadays, most developers work in a distributed environment, with team members located in different parts of the world. LocalXpose makes it easy to share your localhost with others by allowing you to start an HTTP, TLS, TCP, or UDP tunnel in any of the three major regions ( US, Europe, Asia Pacific).

  • Custom Domains and Endpoints: With LocalXpose, you can select your own custom domain ( example.com ) or subdomain (dev.loclx.io), or even an endpoint on a specific port ( us.loclx.io:8080 ). This makes it easy to share your localhost with others without having to remember a complicated URL.

  • Built-in Let's Encrypt: LocalXpose makes it easy to create a let's encrypt certificate for your custom domain with one click. This way, you can share your localhost with others securely.

  • Built-in File Server: LocalXpose comes with a built-in file server, so you can easily share any local system directory with others.

  • Edit Requests and Response Headers: LocalXpose also allows you to edit the request and response headers of your http tunnel. This is useful if you need to adapt your environment for a specific purpose.

Getting Started with LocalXpose

Before you can start using LocalXpose, you'll need to install it on your device. LocalXpose is available for Windows, macOS, Docker, and Linux, so you can run it regardless of your operating system. The installation process is very simple:

Step 1: Go to the LocalXpose website.
Step 2: Click the "Download" button on the navigation bar.

Image description

Step 3: Choose your operating system and download the zip file.
Step 4: Unzip the file and that's it! You're now ready to start using LocalXpose.

Setting Up a Localhost WordPress Site

Before we can use LocalXpose to expose our localhost WordPress site to the internet, we need to set up a localhost WordPress site. Creating a WordPress website locally is a great way to test out new plugins and themes without affecting the live site. And if something goes wrong, you can always restore the site from a backup.

If you don't have a localhost WordPress set up yet, don't worry. It's very easy to do. We'll walk you through the steps below.

Step 1: Download XAMPP

You can download XAMPP on any operating software. You can choose your operating system while downloading the software. To download the software, simply go to the Apache Friends website and click on the "Download" button.

Image description

Step 2: Install XAMPP on your device

Once the download is complete, open the installer and follow the instructions. By default, it will install all the components. If you want, you can deselect the components that you don't want and install them later.

Image description

Step 3: Start the XAMPP Control Panel

After installation, launch the XAMPP Control Panel. On the XAMPP Control Panel, you will see all the services that come with XAMPP. Apache and MySQL are the two services that we need to start for WordPress.

Image description

Step 4: Create a Database for WordPress

Now that the Apache and MySQL services are running, we can create a database for WordPress.

To do that, open your browser and go to http://localhost/phpmyadmin/ . On the phpmyAdmin page, click on the "Databases" tab.

Enter a name for your database in the "Create database" field and click on the "Create" button.

Image description

Step 5: Install WordPress

Now that we have a database set up, we can install WordPress. To do that, go to the WordPress website and click on the "Download WordPress" button.

Image description

Once the download is complete, extract the files and copy them to the htdocs folder. The htdocs folder is located in the XAMPP installation directory.

Image description

After copying the files, rename the wp-config-sample.php file to wp-config.php. Open the wp-config.php file and enter your database information. Save the file and close it.

Now, open your browser and go to http://localhost/wordpress . You should see the WordPress setup page. Follow the instructions on the setup page to finish installing WordPress.

Now your WordPress is set up. If you go to http://localhost/wordpress then you can see your site.

Image description

Exposing the Localhost WordPress Site with LocalXpose

Now that we have a localhost WordPress site set up, we can use LocalXpose to expose it to the internet. LocalXpose makes it easy to expose your localhost WordPress site to the internet. Just follow the steps below:

Step 1: Open a terminal and change the directory to where you have installed the LocalXpose.

Image description

Step 2: Use LocalXpose's HTTP tunnels to expose your localhost URL to the internet. HTTP tunnels allow you to expose your local web servers to the internet, and you will be given a shareable link that is accessible from the internet.

To generate this shareable link, run the below command in the terminal:



loclx tunnel http --to 80


Enter fullscreen mode Exit fullscreen mode

That's it. Now the shareable link should be visible on your screen.

Image description

Image description

In this article, we've shown you how to use LocalXpose to expose your localhost WordPress site to the internet. LocalXpose is a very handy tool that can be used to share your localhost site with others or to test how your site would work if it was live on the internet.

Top comments (0)