Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Apache w/out internet connection

I have installed Apache server on my local machine and managed to see local PHP files with my browser. However, later I found out that I cannot do it if I have no Internet connection. In other words, is it true that Apache cannot display files on my computer if I have no Internet connection? Why does it need Internet to read from the local hard disc? And how I can overcome this limitation?

share|improve this question

migrated from Sep 7 '10 at 21:06

This question came from our site for professional and enthusiast programmers.

marked as duplicate by BinaryMisfit Sep 7 '10 at 21:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

That sounds totally bizarre; hopefully, Apache is configured to listen on the local loopback adapter and isn't depending upon some other network interface being up. What actually happens, in terms of browser output, when you try and serve up a PHP file without a connection? – Rob Oct 7 '09 at 21:21
Sounds like apache is not listening to localhost, rather your network IP. See my comments below. – randy melder Oct 7 '09 at 21:28
Should we assume you are trying to access the site through localhost? – James Goodwin Oct 7 '09 at 21:30 – GrzegorzOledzki Oct 7 '09 at 21:33
probably should be moved to serverfault – randy melder Oct 8 '09 at 12:11

In your /etc/hosts file, append your virtualhost servernames to the end of the localhost line. e.g.:   localhost www.domain.tld www.otherdomain.tld

In your httpd.conf, enter this:

Listen 80 
# make sure all other listen lines are commented out.
NameVirtualHost *:80

In your vhost config files, structure like this:

<VirtualHost *:80>
ServerName www.domain.tld
DocumentRoot /www/domain

<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain

share|improve this answer
@randy melder: instead of having one <VirtualHost> tag for each ServerName, you could have a single <VirtualHost> tag and add a ServerAlias for each additional hostname. – Asaph Oct 8 '09 at 18:37