开发者

Accessing Virtual Host from outside LAN

I'm setting up a web development platform that makes things as easy as possible to write and test all code on my local machine, and sync this with my web server. I set开发者_开发问答up several virtual hosts so that I can access my projects by typing in "project" instead of "localhost/project" as the URL.

I also want to set this up so that I can access my projects from any network. I signed up for a DYNDNS URL that points to my computer's IP address.

This worked great from anywhere before I setup the virtual hosts. Now when I try to access my projects by typing in my DYNDNS URL, I get the 403 Forbidden Error message, "You don't have permission to access / on this server."

To setup my virtual hosts, I edited two files - hosts in the system32/drivers/etc folder, and httpd-vhosts.conf in the Apache folder of my WAMP installation.

In the hosts file, I simply added the server name to associate with 127.0.0.1. I added the following to the http-vhosts.conf file:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "c:/wamp/www/ladybug"
    ServerName ladybug
    ErrorLog "logs/your_own-error.log"
    CustomLog "logs/your_own-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
</VirtualHost>

Any idea why I can't access my projects from typing in my DYNDNS URL? Also, is it possible to setup virtual hosts so that when I type in http://projects from a random computer outside of my network, I access url.dyndns.info/projects (a.k.a. my WAMP projects on my home computer)?

Help is much appreciated, thanks!


403 Forbidden Error message, "You don't have permission to access / on this server."

I stumble through apache configs but it sounds like your authentication is screwed up for when the requests are coming from outside your local network--are you using mod_auth?

Try enabling access from all networks by adding this to your <VirtualHost/> or <Directory/> entry:

Order allow,deny 
Allow from all 


I know this is an old question but I've recently took the time to look into this issue and post my findings.

It's to do with the way your router looks up the address and deals with the request internally. I've posted more information here with diagrams: http://twigstechtips.blogspot.com/2012/01/accessing-dyndns-address-within-lan.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜