0

I'm running Apache on my stationary and I would like to access a website through my laptop.
This is some of the Apache config:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    ServerName mysite.com
    DocumentRoot I:/wamp/www/mysite/
</VirtualHost>

ServerName localhost:80

<Directory />
    Options FollowSymLinks
    AllowOverride all
    Order deny,allow
    Deny from all
</Directory>

On my laptop I've added the following to the HOSTS file:

10.0.0.3   mysite.com

But accessing the page through mysite.com is not very successfull. If I enter the IP address directly, I only get a Forbidden message.

What do I need to do in order to get this to work?

Update

I'm runing WAMPSERVER 2.1 (Apache 2.2.17)
Apache is up and running
I can ping 10.0.0.3 from laptop
I'm not able to ping http://mysite.com from laptop
IE gives me a 403 Forbidden -> The website declined to show this webpage

The only log that get's entries when trying to access the website from my laptop, is access.log.

access.log
10.0.0.4 - - [13/Jun/2011:10:14:04 +0200] "GET / HTTP/1.1" 403 202

apache_error.log
[Mon Jun 13 10:08:16 2011] [error] VirtualHost localhost:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

UPDATE 2
My apache config has the following entry:

AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1

Could it be that this Allow from is stopping other computers accessing the page?

7
  • Post the relevant entries from your error log. If you're getting a 'Forbidden' message the error log will have more details in. There are hundreds of reasons that error could be caused by.
    – user80776
    Jun 13, 2011 at 8:00
  • Are there any firewalls in place? Is the Apache Webservice running? Can it be pinged? Try access it just from the webserver's IP rather than the hosts file, to start with.
    – tombull89
    Jun 13, 2011 at 8:01
  • I've added som info.
    – Steven
    Jun 13, 2011 at 8:17
  • When you're asking a question like this, you need to think what it leaves behind for people who look at the site later - you should upvote answers that were helpful, and create an answer for anything else you do, rather than leaving comments inline. Right now the original problem isn't included in the question, for example.
    – crb
    Jun 13, 2011 at 8:56
  • @crb, how is my original problem not included in the question? The headline states pretty clearly what the problem is. I upvote answers that are helpfull. So far, there is only one answer and it was not helpfull. It did not solve my problem. When time permits, I will add an answer to my own solution and mark is at solved.
    – Steven
    Jun 13, 2011 at 9:26

2 Answers 2

1

I discovered that the problem was in Allow from section.

I just had to add the IP addresses of the computers I wanted to get access.

AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from 10.0.0.1
Allow from 10.0.0.2
Allow from 10.0.0.3
0

You at least should specify a port for your VirtualHost and NameVirtualHost directives. For example:

<VirtualHost localhost:80>

The Apache docs on using name-based virtual hosts are thorough and worth a read.

3
  • I've done that (127.0.0.1:80), but it's not working. I've also tried using 10.0.0.3:80, but doing that, I'm not able to access the page from localhost either. I've read the docs.
    – Steven
    Jun 13, 2011 at 8:31
  • Could Allow from be the source of my problem? See update.
    – Steven
    Jun 13, 2011 at 8:36
  • Yup, that was it. By adding Allow from 10.0.0.3 for my laptop and Allow from 10.0.0.4 for my local computer, then it all worked :)
    – Steven
    Jun 13, 2011 at 8:39

You must log in to answer this question.

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