How to emulate a private IP address for local Apache webserver?

0

I am working on two seperate computers (office PC and home laptop) on the same project. It's a WordPress website. I use Git and Bitbucket for version control and remote branching. On both machines, I'm running Apache2 webserver on Ubuntu 15.10 in virtual host mode. My project is on virtual host on port 91, so http://localhost:91 calls the project on both machines.

At my office PC, I'm connected to a LAN and thus, have a private IP address 192.168.xxx.yy. To test my project site on different devices, I've added this private IP address to my Apache2 vhost config. In WordPress admin, I've set SiteURL = 192.169.xxx.yy. Now I can call the site not only from localhost (work PC) but also from other devices in our LAN / VPN.

To transfer development states between work PC and home laptop, I added the local webroots to the Git repositories plus the latest database export as an sql file. Changing machines, I pull from Bitbucket and run the latest sql dump on the local database.

Now my issue is, since I've changed WP settings on work PC of SiteURL from 127.0.0.1 to the private IP, I'm also transferring this setting to my home laptop. This machine is not connected to any LAN and obviously has no private IP address other than 127.0.01 for localhost. But Wordpress is still looking for 192.168.xxx.yy when I call http://localhost:91 on my home laptop. So, how can I emulate a private IP, which is identical to the one on my office PC? This is neccessary, as WordPress also stores media locations in the database, hence, using the private IP as URL-root, when I add content on work PC.

I've tried to change network settings in Ubuntu network manager from DHCP to manual and added IP address 192.168.xxx.yy. Didn't work. I've also set 192.168.xxx.yy as ServerAlias in the Apache vhost config file. Didn't work either. Any ideas are much appreciated.

Bunjip

Posted 2016-01-24T14:09:47.563

Reputation: 101

From the tag: "Questions about installing and maintaining WordPress belong on WordPress.SE" – DavidPostill – 2016-01-24T15:31:56.190

I'm not quite sure, if I got your message right. Thus, I'd like to kindly ask, what do you want to tell me with your comment, @DavidPostill? – Bunjip – 2016-01-24T16:21:11.420

You are asking an off-topic question. See On Topic. Your question should be posted on http://wordpress.stackexchange.com/

– DavidPostill – 2016-01-24T17:30:41.217

Allright got it. Thanks @DavidPostill. I've studied http://superuser.com/help/on-topic before and felt comfortable to post my question here - as it is definitely not a WordPress question nor is it a plain stackoverflow question. I didn't even feel it belonging to webmasters or serverfault ...

Is there a 'where does my question belong to?' meta forum available to prevent future cross posting issues?

– Bunjip – 2016-01-25T13:11:14.587

http://meta.stackexchange.com with tag site-recommendation – DavidPostill – 2016-01-25T13:15:17.277

Answers

0

The Right Way (tm)

  • Use name-based SiteURL in WordPress (reconfigure vhost in Apache, if it's needed) to something like SiteURL = myblog
  • Assign for the same hostname myblog different IP-addresses in hosts-file on both systems

Lazy Badger

Posted 2016-01-24T14:09:47.563

Reputation: 3 557