This section contains detailed articles elaborating on some of the common issues phpBB users encounter while using the product. Articles submitted by members of the community are checked for accuracy by the relevant phpBB Team. If you do not find the answer to your question here, we recommend looking through the Support Section as well as using the Site Wide Search.

Allowing both local and remote access to forum

Description: Allowing remote access to a forum you've created on a local computer can present problems with proper configuration of the cookies and host name.

In Categories:

Link to this article: Select All
[url=]Knowledge Base - Allowing both local and remote access to forum[/url]

Problem: So, you've set up your forum on your local computer, and you now want to share it with the outside world. So, you set up a domain (or subscribe to one of the many dynamic IP domain services), and start telling your friends about your wonderful creation. They arrive at your site. They register. They try to log on. And they get a "page not found" or "server not responding" error!

"What? I can log in just fine!" you say.

That's when you notice that your friends are getting sent to "http://localhost/forum/" instead of "". How can this be?

Simple - that's what you told the phpBB install program to use. You were setting things up on your local host, so "localhost", "", or your machine's private network IP was the correct setting. But, that only works for you, and that's not what you want now.

"Ah," you say, as the secret unveils itself to you, "I'll now configure phpBB2 to to use as the domain name, and my friends will be sent to the right place!" You make the change. Your friends can now log in. And everything is happy.... Until you decide to log in, and find out that your DSL router has security settings that prevent you from accessing your computer by its outside-world IP, so "" doesn't work for you.

This is where some magic needs to occur.

History: Computers do not like names. They want addresses. Addresses are numbers, which is how a computer "thinks". Way back in the dark days of internet, before "named hosts" could be resolved via the yet-to-be-invented Domain Name Service (DNS), everyone had a paper list of host names and their internet addresses. Things were simpler back then, because there were only a few dozen computers on the network, world-wide.

When those lists got too big, though, someone came up with the idea to put it into the computer itself, and tell the computer how to use it to look things up. This list was called "HOSTS.TXT", and was maintained by SRI-NIC. Unix machines used a subset of the information from HOSTS.TXT as their local "/etc/hosts" file, so this is commonly called "hosts-based lookup". When DNS was invented, it was still useful to have hosts-based lookup for machines that didn't need to have their own "world-accessible" DNS host name, so it stuck around. It is so useful, in fact, that most TCP/IP installations will use the hosts file before they try DNS, because it's less overhead.

Fixing it: Getting back to your problem, it's time to take advantage of this old-school magic, and make "" work for machines hiding behind that DSL router. You do that by adding an entry to each machine's hosts file, which looks like this:

Code: Select all

If you do this on another machine, you need to replace "" with the private network address of the server.

Once you save this file, you will be able to use your forum from the local machine again, because the login redirection to "" will be sent to, instead of the world-accessible IP the router shows your friends.

But, wait - where is this wonderful file? That depends upon your operating system!

Linux- and Unix-based systems (such as OS-X) keep the file in /etc, so its name is /etc/hosts (no extension). Windows systems keep it either in the main Windows directory (c:\windows\hosts or c:\winnt\hosts), or buried in \windows\system32\drivers\etc\hosts. You can use any text editor to make the changes, such as vi, emacs, or NOTEPAD.EXE.

One final note. Windows 3.1, 95, 98, and ME do not come with a hosts file by default. There will be a file named HOSTS.SAM in the Windows directory, however. You must copy this to just "HOSTS" (no extension) for it to work, which might be a problem if you let Windows "help" you with extensions, and especially if you use the default settings in Win95/98/ME to "hide extensions for known file types". When saving the changes, make sure to preceed and follow the filename hosts with a double quote such as:

Code: Select all


This will convince Windows that you're serious about not having a file extension.