Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 setup 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!

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Your servername will need to a FQDN (Fully Qualified Domain Name) to work externally.

Config example:

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

You'll also need to open up port 80 via your router and forward it to your internal server IP address.

You won't be able to use just http://projects to connect to your server unless you configure a DNS server and use that.

share|improve this answer
add comment

As ffreedon_is_chaos points out you need to use the FQDN to get to the service from outside.

In addition to a ServerName you can also add a Server Alias which will allow you to access the domain with other names, which means you would still be able to use the non FQDN on the inside. E.g.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "c:/wamp/www/ladybug"
    ServerName ladybug.something.com
    ServerAlias ladybug www.ladybug.something.com
    ErrorLog "logs/your_own-error.log"
    CustomLog "logs/your_own-access.log" common
</VirtualHost>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.