I'm building a website on my laptop. To see how it renders, I serve it locally on port 80 with lighttpd. I can then open it in my laptop's browser via any IP or URL referring to the laptop http://localhost or (IP on the local subnet) or http://coulomb (its hostname) . Fine.

Now I want to test its responsive design, so I try to open the laptop address in my phone's browser: or http://coulomb. Both devices (phone and laptop) are in the 192.168.1.* subnet of my Wifi DSL box. Strangely to me, the phone's browser (be it Firefox or Chrome) "rephrases" the IP into "localhost". The connexion then fails with a "site unreachable"-like error.

lighttpd is not the culprit. To check this I instead served the files of some directory of the laptop with sudo ruby -run -ehttpd . -p80, the behavior is the same.

There is something with the port. If I serve the website on port 3000 (as shown in lighttpd docs) or 8000 or 8080 it works: the phone's browser opens (or :8000 or :8080) and I see the website.

The phone seems not to be the culprit either: I can open the HTTP interface of the DSL box at, default port, without problem. (If asked to, I might try and use a computer client instead of the phone, but it's not easy for practical reasons.)

If you wonder why I insist on serving it on port 80: it is built with Wordpress, and doesn't work right on a custom port, the plain text is shown but no css or images are loaded. I don't want to workaround the problem by tweaking Wordpress to make it custom-port-compatible, because when the site is ready I'll mirror it to a public server.

  • localhost is just that - the local host. You need to make sure you're serving on the LAN address as well Commented Aug 25, 2021 at 21:30
  • if you have lighttpd listening on localhost:80, aka, aka the loopback interface, that is very different than listening on , listen on all interfaces
    – infixed
    Commented Aug 25, 2021 at 21:39
  • Edited the question. In fact the HTTP server configuration doesn't mention hostname or host IP, only the port on which to serve. Additionally my tests with other ports prove the HTTP server is OK.
    – L. Levrel
    Commented Aug 26, 2021 at 14:39

1 Answer 1


You can't define the WordPress site as "localhost", since then as you've found out it will insist on referencing itself by that name.

Instead, use a name that can be resolved on your LAN (if necessary by using the relevant /etc/hosts files, but ideally by using your DNS), and make sure you're listening on the LAN IP address as well as localhost

  • Got it! WP uses absolute addresses, not relative addresses. Now I'll have to find the way to use relative addresses, or to update existing contents, but that's another story. Thanks!
    – L. Levrel
    Commented Aug 26, 2021 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .