Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:Westi/Hosting WordPress Behind NAT

This article is marked as in need of editing. You can help Codex by editing it.

If you want to host your WordPress blog on a server behind a NAT device you may find it is difficult to setup your blog so it is accessible, both from the Internet, and from the local-area network that sits behind the NAT device. This article details the steps necessary to configuring your computers to access that blog.

Setting up WordPress

First of all, you need to complete the Famous 5-Minute Install process using the Internet domain name that you have picked for your blog. For this example, assume your blog is setup with a domain name of www.example.com.

Next, your domain name should be setup so that it points at the Public IP Address of your ADSL router/NAT device, which in turn, should be setup to forward HTTP requests to your web server.

After those two steps, you should have a WordPress blog that works fine when accessed by domain name from the Internet. However, if you try to access your blog by domain name from your local network, it will not work without further configuration.

Configuring access from local machines

In order to enable access to your blog from your local network, you need to perform an extra configuration step on each of the machines in that local network.

Basically, you need to tell all of the local machines to access the local web server directly when they want to view your domain. This is achieved by putting an entry in the hosts file. Typically, the hosts file can be found on Windows XP located in the C:\windows\system32\drivers\etc folder and on Linux located in the /etc directory.

Enabling access on the machine running the web server

If the web server is running on this machine, you need to edit the entry for localhost so that it reads as follows:

   127.0.0.1 localhost www.example.com

Enabling access on other machines on the network

If the web server is running on another machine, for example at IP Address 192.168.0.100 you need to add an entry for www.example.com as follows:

   192.168.0.100 www.example.com

Sources