Local WP is a fantastic piece of software that lets you quickly spin up a WordPress website on your computer. It’s meant to be used for local WordPress development on your computer and then publish on the web.
However, you can also generate a live link that lets you access the website outside your network. I recently got to use it and it was very slow. Then I figured out there is a way to make this less miserable on my slow connection. Let’s find out.
The Back Story
I have a windows machine laying around, collecting dust, although it is a solid machine with good hardware, 32 gigs of RAM, etc. I am always lazy when it gets to selling stuff so, I wanted to make it useful somehow.
So, I decided to use it as a server – running 24/7, which I can easily access from anywhere with VNC and have a powerful machine to do anything that needs a computer. In my case, it is going to host WordPress sites that are being developed and a media center. I plan to get more use out of it in the future.
I installed Local WP and started adding the sites I have been working on. If you are here reading this, you probably know how good it is. It is very important for me to access my sites when I am home while the server is running at my office.
As obvious, my home network and office network are different. However, being close to the city, the network latency is minimal. So, I can use VNC to operate the server PC from my home.
As good as it sounds, it is not that smooth to do regular tasks over VNC. You can make good use of it while you are not with your laptop and need to do some quick work from your phone. However, it will still feel choppy and not the perfect solution for a virtual desktop. Especially if both internet connections have poor speed.
I needed a solution to access my Local WP sites smoothly…
But outside my office.
Local WP flawlessly creates pretty links like ‘mywebsite.local’ when you add a site. You can access the site from your computer only using that link. However, using the Live Link, you can share with anyone to view the site both from your network or outside the network. It magically manages all the DNS, IP, or any other things needed.
As I have mentioned before, it is very slow. When I visit the site using the live link, it takes 4-5 times longer than it does locally. This can cause various reasons along with both my internet connection at home and office are poor. I still believed it was longer than it should be.
How Did I Do This
My solution to the problem is using the Static IP address of my server instead of using the Live Link. This way the DNS lookups are minimal and we get access straight to the source. That hugely improves load time.
Before you attempt to do this, you need to check the following:
- You have a Static IP address given by your ISP
- Port 80 (the usual HTTP Port) is not closed by your ISP
We will need to set the Router Mode on Local to localhost. To do this, open Preferences > Advanced > Router Mode.
You will notice the Site Domain label got changed to Site Host. We will use the Port number shown after ‘localhost:‘ so make a note of it, as we are going to use that later.
Important Note: Changing the router mode will disable the SSL feature of Local WP. So, do use it wisely.
You will also need to ignore the WordPress URL mismatch warning. If you click Fix, it will update the database with the new URL like http://localhost:10004 and we don’t want that.
So, the next step is to change siteurl and home from the wp_options table. You can easily do this using Adminer supplied with Local WP.
Now, the next thing we need to do is port forwarding. It needs to be done from your router’s dashboard or admin panel. Depending on which router you are using, the settings can be different. You can google for Port Forwarding settings of your router to learn more. In my case, I am using ASUS RT-AX53U at my office.
Here you can see I used External Port 80, and Internal Port 10004 (as it was on Local WP). The Internal IP Address is set to my server’s IP address on the router. Lastly, the protocol is set to TCP. You should change the Internal Port and Internal IP Address according to your setup.
Now you should be able to access the site with the Static IP Address from everywhere. In special cases, you need to configure your router if it doesn’t work inside the host network but it should work just fine.
Here is my before and after using Live Link vs Static IP. It’s definitely an improvement. Meanwhile, I am also trying to speed up file access from my server. So, that may come next.
Hopefully, this helps you speed up your workflow. Let me know what you think and feel free to give suggestions if it can be better.