Question

I have setup a small website using LAMP (Raspbian) and Wordpress.
No domain name will be registered for the website.
For the moment I am accessing the site from inside the local network.
To access the site I just hit the IP address of the server (internal).
I want to access the site from outside the local network via the public IP.
The public IP is static and a Firewall is configured to translate the internal IP/default port(80) to the public static IP/(random port) and vice versa. Internal IP is static also and the RPi is directly connected to the FW via cable.

If I send a request from an external IP the page never loads and inside my admin panel(via WP Statistics plugin) I can see the request.

I would like to note that I have modified the wp-config.php and specifically these lines:

define('WP_HOME','http://internalIP/');

define('WP_SITEURL','http://internalIP/');

What changes do I need to make so that the site will respond to the external requests?

Is there anything I should check in my Wordpress/Apache/mySql/Linux configuration?

Please let me know if any configuration info would be useful.

Was it helpful?

Solution

When installing WP onto an IP address (or hostname), WP will only respond to requests on that IP address. Any request from another IP address even if it resolves to the same server, will result in a redirect to a WP error page.

In this situation, I would do this:

  1. Install WP on the public IP address. This will work if you can route to the public IP address internally.
  2. f you cannot route to the public IP address internally then I suggest installing on a hostname. You need to configure your DNS so that internally it will resolve to the internal IP address; and externally it will resolve to the public IP address.

OTHER TIPS

While it isn’t quite considered to be intended mode of operation WP_HOME and WP_SITEURL can be declared dynamically conditional on individual request, rather than hardcoded.

There is very little state in PHP natively, so if you tell it to handle specific request as if responding to this or that hostname/IP — it will.

Of course while this will make WordPress core boot, there is some state on its side of things such as URLs captured in content and so on.

In a nutshell this is certainly possible, but practicality of it depends a lot on specifics of the site.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top