0

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!

3 Answers 3

1

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.

2
  • 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, 2011 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. Feb 3, 2011 at 2:03
0

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.

-1

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!

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

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