Problem with WordPress sites on local network
Posted by: dr_coder (45.14.207.---)
Date: May 20, 2025 03:30PM

I hope somebody can help me with this really puzzling problem: I cannot reach 5 out of my 6 local WordPress websites on any device in my local network.

The context:
1. I am using Wampserver 3.3.2
2. I am using WordPress 6.8.1
3. I am testing the websites on an iPad running Safari, an Android phone, an Amazon Fire tablet running the Silk browser, plus a range of all the obvious browsers on a Windows desktop.
4. All of my 10 non-WP local websites work on the local host machine and across the network.
5. According to httpd.conf, Apache is listening on all the relevant ports.
6. One local WordPress website works across the network; five don't.

Here is the httpd-vhosts.conf entry for the WordPress website which works:
<VirtualHost *:${MYPORT8020}>
ServerName fourscoreyears
DocumentRoot "c:/wamp64/www/fourscore years"
<Directory "c:/wamp64/www/fourscore years/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip 192.168.18
</Directory>
</VirtualHost>

And here is the entry for one of the five that don't:
<VirtualHost *:${MYPORT8018}>
ServerName trialsite
DocumentRoot "c:/wamp64/www/trial site"
<Directory "c:/wamp64/www/trial site/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip 192.168.18
</Directory>
</VirtualHost>

Can anyone give me an idea of why the first works and the second doesn't?

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: Otomatic (Moderator)
Date: May 20, 2025 04:08PM

> I am using Wampserver 3.3.2
Obsolète -> 3.3.8

Assuming we do not have access to adding record to a DNS Server we have to come up with a different solution.

The simplest of these is to use the IP Address of the PC running the WAMPServer(Apache) server and a specific port number. So thats a different port number for each of our sites we want to use from a phone.

From the phone using the ip of the PC running WAMPServer with the port number i.e. 'http://192.168.0.10:8018'

> Require local
> Require ip 192.168.18
This will only work if your phone, tablet, iPad, etc. have a fixed IP in the 192.168.18 range.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: dr_coder (45.14.207.---)
Date: May 21, 2025 10:01AM

Otomatic, that's exactly how I access all my local websites across the network! To (successfully) call up the 'fourscore years' site I enter 'http://192.168.18.124:8020'. But when I enter 'http://192.168.18.124:8018' I get "This site can't be reached" with the token 'DNS_PROBE_FINISHED_NXDOMAIN'.

(I note that I could update Wampserver, and will, but this will not solve this particular problem, will it?)

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: Otomatic (Moderator)
Date: May 21, 2025 11:28AM

Hi,

- Empty browser cache

- Clear the DNS cache: Right-click -> Tools -> Restart DNS

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: Otomatic (Moderator)
Date: May 21, 2025 04:17PM

Hi,

- PC with Wampserver ip 192.168.0.10
- Smartphone ip 192.168.0.14

- httpd.conf
Define MYPORT8082 8082
Define MYPORT8081 8081
...
Listen 0.0.0.0:${MYPORT8082}
Listen [::0]:${MYPORT8082}
Listen 0.0.0.0:${MYPORT8081}
Listen [::0]:${MYPORT8081}
- httpd-vhosts.conf
<VirtualHost *:${MYPORT8081}>
  ServerName photos-dom
  DocumentRoot "g:/www/phottello"
  <Directory  "g:/www/phottello/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
    Require ip 192.168.0
 </Directory>
</VirtualHost>
#
<VirtualHost *:${MYPORT8082}>
  ServerName photos-mouni
  DocumentRoot "G:/www/wampserver"
  <Directory  "G:/www/wampserver/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
    Require ip 192.168.0
 </Directory>
</VirtualHost>
#
From the Smartphone:
'http://192.168.0.10:8081/'
and
'http://192.168.0.10:8082/'
work fine.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: dr_coder (45.14.207.---)
Date: May 21, 2025 04:34PM

Hi Otomatic,

On my Android phone, my Fire tablet, my iPad, and each of the browsers on my network Windows desktop, I KEEP clearing their caches. 11 of my development sites continue to work, the 5 sites that don't work on the network continue to fail.

For your second recommendation, I assume you are referring to Wampserver on the host Windows machine. Again I have flushed the DNS ache repeatedly, and restarted DNS (doesn't this also happen every time I call up Wampserver when I switch my host machine on every morning?) There are never any problems with localhost on the host machine: all 16 sites in development (usually = maintenance) always work fine; and this seems to have no effect on the devices on the network.

I appreciate your coming to my assistance, but we don't seem to have located the real problem!

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: Otomatic (Moderator)
Date: May 21, 2025 05:28PM

Hi,

WordpPress stores the basic urls in its database in the wp_options table, in the two fields home and siteurl there is ServerName, for example 'http://wordpress.internal'.
Perhaps this is why the url is no longer 'http://wordpress.internal' but 'http://192.168.18.124:8018'.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: dr_coder (45.14.207.---)
Date: May 22, 2025 12:51PM

Hi Otomatic,

My last reply (4:34PM yesterday) was to your reply of 11:28 AM, so I missed your very detailed reply of 4:17PM. Sorry.

In response to that, I can confirm that my settings exactly match your examples of httpd.conf and httpd-vhosts.conf, but using the suggested URLs for a Smartphone (with different numbers of course) continued to fail.

Thank you now for your reply of 5:28PM. I have edited the urls for 'home' and 'siteurl' (in the wp_options table) directly, more than once.

However, I have now realised where I have been going wrong! I have been assuing I was familiar enough with the local Domain Name System—but I only grasped the concepts; I was ignorant of the MECHANICS!

(With a little help from ChatGPT) I now realise I have to master the ins and outs of the local DNS—as you have quite rightly been suggesting. This is not primarily a Wampserver issue.

I am all the more grateful for your patient assistance!

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: Otomatic (Moderator)
Date: May 22, 2025 02:54PM

Hi,

On Windows, the DNS lookup order is:
- own name (LocalPriority)
- local, i.e. hosts file (HostPriority)
- local DNS cache (DnsPriority)
- Internet DNS (NetbtPriority)
This order corresponds to the registry key:
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider

This can be checked by Right-Click -> Tools -> Check DNS lookup order.

In your case* it might be necessary to set up a local DNS like Unbound DNS.
There's an article on a simple installation procedure, but it's in French:
Installing Unbound DNS

*I only use one PC, so I can't try out network IP access except with my smartphone.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Problem with WordPress sites on local network
Posted by: dr_coder (45.14.207.---)
Date: May 23, 2025 09:39AM

Hi,

Since this is a forum, and other Wampserver users may encounter similar problems I should mention that the quick fix which ChatGPT suggested was to add these lines to each problem site's wp_config file:
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);

In conjunction with clearing the cache (once again) on each network device, this seems to have done the trick.

But the long term solution is obviously what you suggested, Otomatic: a fully-fledged local DNS. I tried dnsmasq, but couldn't get it to work on Windows. I have now set up (but not yet tested) a Windows app called Acrylic DNS Proxy (recommended by ChatGPT).

Thanks again, Otomatic!

Options: ReplyQuote


Sorry, only registered users may post in this forum.