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 develop on my local computer using wamp. When I start a new project I add a new virtual host entry to my httpd.conf file like so:

ServerName localhost:80

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "c:/wamp/www/"
NameVirtualHost 192.168.1.103
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
    ServerName localhost
    DocumentRoot "c:/wamp/wwwjack/"
</VirtualHost>

<VirtualHost 127.0.0.1>
    ServerName fr.local
    DocumentRoot "c:/wamp/fr/"
</VirtualHost>

<VirtualHost 127.0.0.1 192.168.1.103>
    ServerName gg.local
    DocumentRoot "c:/dev/gg/"
</VirtualHost>

<VirtualHost 127.0.0.1>
    ServerName codeignite.local
    DocumentRoot "c:/wamp/wwwcodeigniter/"
</VirtualHost>

Periodically I would like to open up port 80 on my local network to give folks a preview of what I'm working on. I'm not talking about hosting a website from my home computer, just giving a quick snapshot.

After forwarding the port to my local IP, how do I setup so that a user only needs to type in my ip address and they see the virtual host I would like them to view? I would rather them not have to edit their host file for this.

Thanks!

share|improve this question

3 Answers 3

up vote 1 down vote accepted

You can't the way you are doing it. They'd have to be vpn'd into your network for that to work. And even if they were you'd have to use your lan side address, not your local loopback (127.0.0.1).

When apache gets the request it will try to match it with the vhost, but none of them will match.

share|improve this answer
    
Could you recommend a solution for me? Or if the solution is much more complicated i'll just keep continue as I have been and upload it to a public server...was just hoping to cutdown on that time. –  Rapture Feb 3 '11 at 0:18
    
What you want to do is not terribly complicated, but to serve up the app you want per customer, you can't have multiple vhosts on the same ip, unless you use dns and ServerName maps to the name the customer is using to visit the site. For the time being I would continue to upload your sites, and learn a little more about NameVirtualHost. Once it clicks you will think of a number of ways to do what you want. –  Nathan Powell Feb 3 '11 at 2:03

Another option is to get a domain, and use DNS for your app-serving. So...

newapp23.yourdomain.com
newapp25.yourdomain.com

Set the names to be your home address. You'll have to change your VHost descriptions to accommodate (and your code must accept it too), but it would work.

share|improve this answer

I think you could use the No-IP service (http://no-ip.com/) to forward your ip to your box. Maybe you could then add the noip address to the vhosts list. Not sure though. Good luck!

share|improve this answer
    
If you are unsure, you should refrain from answering. –  Nathan Powell Feb 3 '11 at 0:08
    
It doesn't hurt to try things... –  Paul Feb 3 '11 at 0:18
    
I mean, your answer didn't even suggest a solution. Only telling him he couldn't do it. –  Paul Feb 3 '11 at 0:19
2  
If you end a post with "Not sure" you should probably keep it to yourself. –  Nathan Powell Feb 3 '11 at 2:06

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.