Author |
|
Mike-H
Joined: 29 Dec 2008 Posts: 16
|
Posted: Wed 07 Oct '09 23:42 Post subject: Virtual Hosts work but not localhost |
|
|
Hi,
I recently installed apache and php on a second laptop computer for testing & development. I created a directory to hold all my virtual hosts and so far I have been able to access the 2 v-hosts I have created. But I am unable to access anything via localhost (http://localhost). The files are in a directory called c:/LocalhostWebPages. httpd.conf contains the following line:
DocumentRoot "C:/LocalhostWebPages".
I have tried accessing the localhost, an html index file and a php index file, nothing will work. I think I must have something else in the httpd.conf file that is amiss, but I am not seeing it. Does anyone have any ideas?
Thank you,
Mike |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 08 Oct '09 1:32 Post subject: |
|
|
so exactly what happens when you go to http://localhost?
Does the browser timeout or you get one of the two v-hosts? |
|
Back to top |
|
Mike-H
Joined: 29 Dec 2008 Posts: 16
|
Posted: Thu 08 Oct '09 15:04 Post subject: |
|
|
Sorry to have omitted that little detail
When I type http://localhost in the address bar I get
"Forbidden
You don't have permission to access / on this server."
When I type http://localhost/index.html in the address bar, I get:
"Forbidden
You don't have permission to access /index.html on this server."
Does this point to anything?
Thanks for your help.
Mike |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
|
Back to top |
|
Mike-H
Joined: 29 Dec 2008 Posts: 16
|
Posted: Thu 08 Oct '09 22:39 Post subject: |
|
|
Thanks, but there must be some other problem. The following is in the httpd.conf file:
DocumentRoot "C:/LocalhostWebPages"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "C:/LocalhostWebPages">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
... snip ... (comments omitted)
I also tried changing the directory for localhost from "C:/LocalhostWebPages" to "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" in both the DocumentRoot statement and the second <Directory> statement listed above, but this didn't make any difference.
Mike |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 09 Oct '09 20:37 Post subject: |
|
|
did you restart Apache after making the changes? |
|
Back to top |
|
Mike-H
Joined: 29 Dec 2008 Posts: 16
|
Posted: Fri 09 Oct '09 21:12 Post subject: |
|
|
Yes, I restart apache every time I make a change to httpd.conf. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 09 Oct '09 21:21 Post subject: |
|
|
what is in your error log? |
|
Back to top |
|
Mike-H
Joined: 29 Dec 2008 Posts: 16
|
Posted: Fri 09 Oct '09 21:55 Post subject: |
|
|
Here is the log from today. The errors seem to come up when I try and restart Apache, nothing is entered when I try to access a localhost web page.
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.7422GX] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.7422GX] does not exist
[Fri Oct 09 07:28:27 2009] [warn] pid file C:/Program Files/Apache Software Foundation/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Oct 09 07:28:28 2009] [notice] Apache/2.2.11 (Win32) PHP/5.2.10 configured -- resuming normal operations
[Fri Oct 09 07:28:28 2009] [notice] Server built: Dec 10 2008 00:10:06
[Fri Oct 09 07:28:28 2009] [notice] Parent: Created child process 1220
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.7422GX] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.7422GX] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.7422GX] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.7422GX] does not exist
[Fri Oct 09 07:28:29 2009] [notice] Child 1220: Child process is running
[Fri Oct 09 07:28:29 2009] [notice] Child 1220: Acquired the start mutex.
[Fri Oct 09 07:28:29 2009] [notice] Child 1220: Starting 64 worker threads.
[Fri Oct 09 07:28:29 2009] [notice] Child 1220: Starting thread to listen on port 80.
[Fri Oct 09 14:52:27 2009] [notice] Parent: Received restart signal -- Restarting the server.
[Fri Oct 09 14:52:27 2009] [notice] Child 1220: Exit event signaled. Child process is ending.
[Fri Oct 09 14:52:28 2009] [notice] Child 1220: Released the start mutex
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.7422GX] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.7422GX] does not exist
[Fri Oct 09 14:52:29 2009] [notice] Child 1220: All worker threads have exited.
[Fri Oct 09 14:52:29 2009] [notice] Child 1220: Child process is exiting
[Fri Oct 09 14:52:30 2009] [notice] Apache/2.2.11 (Win32) PHP/5.2.10 configured -- resuming normal operations
[Fri Oct 09 14:52:30 2009] [notice] Server built: Dec 10 2008 00:10:06
[Fri Oct 09 14:52:30 2009] [notice] Parent: Created child process 3744
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.7422GX] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.7422GX] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.7422GX] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.7422GX] does not exist
[Fri Oct 09 14:52:31 2009] [notice] Child 3744: Child process is running
[Fri Oct 09 14:52:31 2009] [notice] Child 3744: Acquired the start mutex.
[Fri Oct 09 14:52:31 2009] [notice] Child 3744: Starting 64 worker threads.
[Fri Oct 09 14:52:31 2009] [notice] Child 3744: Starting thread to listen on port 80.
Thanks,
Mike |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 09 Oct '09 22:06 Post subject: |
|
|
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.7422GX] does not exist
obviously you have at least one document root pointing to a place that does not exist in the filesystem.
if you wish post your config at http://apache.pastebin.com
and then post the link here to your config there |
|
Back to top |
|
Mike-H
Joined: 29 Dec 2008 Posts: 16
|
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 09 Oct '09 22:39 Post subject: |
|
|
There is a little caveat in the vhost configuration that is stated in the Docs, I've rarely ever seen it do as it is documented "Main Host Goes Away".
In most case you just get one of the vhosts instead of the main host
I would expect that if you commented out the
Include conf/extra/httpd-vhosts.conf
it would come back. This is do to the first vhost needing to be a duplicate of the main host. Since you did not include that file (which is where I figured the bad docroot is at). If you try it with that line commented out and it indeed does work, then that is where the problems stem.
I'd suggest first vhost being
<VirtualHost _default_:*>
DocumentRoot "C:/LocalhostWebPages"
</VirtualHost>
That is typically all you need. |
|
Back to top |
|
Mike-H
Joined: 29 Dec 2008 Posts: 16
|
Posted: Mon 12 Oct '09 19:01 Post subject: |
|
|
Victory!
Yes, that worked. There are a few other lines already in that vhost definition in the vhost file. I left them intact and changed the document root as you suggested. Now the v-host sites work, as does the localhost. The vhost definition is started with this line:
<VirtualHost *:80> I don't know how that differs from what you posted, but I left it as it is and all seems ok for now.
Thank you for your help. Now I can finally get back to work!
Mike |
|
Back to top |
|