Support » Localhost Installs » Why does my website return a private address?

  • Resolved 3bx



    I have just finished a successful WordPress installation on a local ubuntu server vm. In the general settings area I have this: I have also modified Apache2 ports.conf and the sites-available default file so the website works on port 5580. I also have a firewall configured with a one to one translation so the outside address public address A.B.C.D:5580 gets translated to

    When I put A.B.C.D:5580 into a browser the WordPress site main page does come up, so I know the translation is working, but when I try to navigate off the main page it does not work and the browser ends up showing a “could not connect” with for example this in the browser address bar:

    This is different behavior than local browsing, where everything works.

    Why is the web site returning the private address?

    Anyone know what kind of changes I need to make to get navigation off the main page working from outside the local network?


Viewing 15 replies - 1 through 15 (of 28 total)
  • If you are going to use the outside address, you need to always use the outside address. That includes posts and site configuration– wp-admin->Settings-General. If that local address shows up anywhere in the html/css/javascript of the site the browser is going to look for content on a local network– the browser’s local network, not the network local to the server (though I would expect it to work if you are browsing from the same network. I don’t know what to make of that at this point)

    Thanks for your input.

    Let me restate the problem. My new WordPress installation works fine on the local network. I have a firewall that translates the local address of the website to a public outside address. I can successfully access the website from the outside with the translated outside address, but only the main page works. When I navigate off the main page I get a “could not connect” message in the browser and the address that one moment earlier had been the correct public address, now shows up as the translated private address that I have configured in the Site and WordPRess Address section of the General settings.

    I think the issue might be as s_ha_dum describes. If you want your site to be completely accessible from the WAN, you may need a domain name (or external ip) in your WordPress addresses in general settings, rather than an address in the private ip range. The internal ip address will work fine for access within the LAN, but will probably always break when accessed from the WAN.

    … now shows up as the translated private address that I have configured in the Site and WordPRess Address section of the General settings.

    That is your problem. “View source” on the page that works and I bet you see that private address in there somewhere. As I said, you need to use that external address everywhere, including in General Settings, if you are going to access this from outside the LAN.

    ClaytonJames and s_ha_dum, I appreciate the help, Thanks!

    I just changed the General Settings Site and WordPress Address section to localhost instead of the static local address of the server interface or the translated outside address configured on the firewall.

    So the site still works locally.

    When I first accessed the site remotely after making this change I got only the “It Works!” page and not my WordPress site. To solve this I changed the name of the index.html file in /var/www to paused_index.html. Now when I access my site from the public internet using the public translated address, the main WordPress page comes up successfully, but again…any navigation off the main page results in a “can’t connect” web page for http://localhost:5580/wp-login.php

    s_ha_dum I did a source view of the working main page like you mentioned, and you are right it shows the exact information you put in the WordPress and Site Address section of the General Settings. I’ve included the output below.

    I’m pretty sure I cant put the translated public address in the WordPress and Site Address section and still have the website work locally, that’s why I used localhost instead.

    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <title>3BX | Making ways to know..</title>
    <link rel="profile" href="" />
    <link rel="stylesheet" type="text/css" media="all" href="http://localhost:5580/wp-content/themes/twentyeleven/style.css" />
    <link rel="pingback" href="http://localhost:5580/xmlrpc.php" />
    <!--[if lt IE 9]>
    <script src="http://localhost:5580/wp-content/themes/twentyeleven/js/html5.js" type="text/javascript"></script>
    <link rel="alternate" type="application/rss+xml" title="3BX » Feed" href="http://localhost:5580/?feed=rss2" />
    <link rel="alternate" type="application/rss+xml" title="3BX » Comments Feed" href="http://localhost:5580/?feed=comments-rss2" />
    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost:5580/xmlrpc.php?rsd" />
    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost:5580/wp-includes/wlwmanifest.xml" />
    <meta name="generator" content="WordPress 3.4.1" />
    	<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>

    I am reasonably confident that you just won’t have any success serving a WordPress site to the WAN using locahost or an internal ip address in your general settings.

    – using an internal ip address makes it fully accessible only from the LAN,

    – using localhost makes it fully accessible only from the machine where WordPress is installed.

    My best guess on this would be that if you want it to be viewed by the outside world, you either need to use a domain name that resolves to your external ip address, or your numeric external ip address in your URL’s in general settings.

    The reasoning here I think, is that if you have localhost in your URL’s and I can view your site from another machine, the minute I make a request for any other resource on your site my browser attempts to resolve that address to my own machine (because every machine is localhost) and it will fail.

    Forgot to mention that my wp-config.php file is configured with: DB_HOST as localhost:5580


    I come from a networking background so it just made no sense to me to configure the outside address on a local machine since the firewall is doing the translations.

    But I took yours (and s_ha_dum’s) advice anyway and now it works!

    It seems wrong that I can put an outside public address in the browser bar on a machine behind the firewall and have it work, but hey it works.

    Thanks again for the help, I appreciate it!

    DB_HOST as localhost:5580

    I’m really not sure why you would want to do that. I think by default, mysql requests on ubuntu are restricted to localhost.


    I changed it back to DB_HOST as localhost without the port. Thanks.

    … to configure the outside address on a local machine since the firewall is doing the translations.

    The address at wp-admin->Settings->General is the address used by WordPress when generating URLs. That address gets embedded into the markup of the site. Now, think about what is happening. The firewall will translate the request you make to “A.B.C.D” and that works but you get a page with ‘localhost’ URLs in it. The firewall doesn’t translate the URLs in the page. Those just pass through. When you click a a link (from outside your LAN) there is no way your firewall can translate a request to “localhost”, or to “” because those addresses will never get to your firewall at all. The browser doesn’t know where it is. In fact, it is being specifically told to look in the wrong place.

    The downside to this is that you are in a sense connecting over the internet every time you connect to your site. Requests are sent just as if you were visiting Google or any other website, though it may only get as far as your ISP’s router before turning around.

    It seems wrong that I can put an outside public address in the browser bar on a machine behind the firewall and have it work, but hey it works.

    This happens if your firewall is configured to block loopback connections. Other than that, like s_ha_dum said, it’s no different from accessing any other website.


    This happens if your firewall is configured to block loopback connections.

    I’m definitely not a network guy, but if the goal is to make the site accessible from the WAN, wouldn’t this simply be happening because registered domain names resolve to numeric ip addresses which do not include loopback interfaces and address blocks reserved for private internal networks? (As in, you gotta’ go out to come back in?)

    In the absence of using a registered domain name, what method other than the static ip address could one use to make the server available from outside the network?

    If the firewall blocks loopback connections, trying to access the external address from the local network wouldn’t work. Even though the address resolves to a public IP, the firewall knows the connection originated from within the local network and blocks it.

    I ran into that problem when setting up a test site with dyndns. Other people could see the test site, but I couldn’t. That might be why 3bx has the impression that putting your own public address into the browser doesn’t work.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Why does my website return a private address?’ is closed to new replies.