Forward external connections to specific directories
Posted by: tspesh (---.hfc.comcastbusiness.net)
Date: February 08, 2013 06:35PM

I have WAMP set up on my laptop and primarily work from there. I have virtual hosts set up fine and that all works locally, what i'm wondering is if there is a way to send my desktop to a specific directory depending on what address I use on my desktop.

So let's say my laptop (192.168.1.120) has:

www/project1
www/project2


I set my host file on my desktop (192.168.1.121) to:

192.168.1.120 www.project1.com
192.168.1.120 www.project2.com


So what I want is for my desktop to go to the appropriate project based on the URL.


The only way around this now, that i'm aware of, is to constantly change the root directory on the laptop. Surely there is a better way?

Ideally, I'd also like to do this over the web too, but first I'd just tackle the issue on the LAN...

Options: ReplyQuote
Re: Forward external connections to specific directories
Posted by: stevenmartin99 (Moderator)
Date: February 08, 2013 06:36PM

yes its called vhosts

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Forward external connections to specific directories
Posted by: tspesh (---.hfc.comcastbusiness.net)
Date: February 08, 2013 06:40PM

I'm not sure you read the post...

Quote

I have virtual hosts set up fine and that all works locally, what i'm wondering is if there is a way to send my desktop to a specific directory depending on what address I use on my desktop.

Options: ReplyQuote
Re: Forward external connections to specific directories
Posted by: stevenmartin99 (Moderator)
Date: February 08, 2013 06:46PM

your set up is correct ..


The hosts file on desktop will point those domains to the ip of the laptop.

so now you need the laptop (apache) to tell the difference between the requests and point it to the correct folder,

so i dont think the vhosts is setup correctly.

can you paste it?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Forward external connections to specific directories
Posted by: tspesh (---.hfc.comcastbusiness.net)
Date: February 08, 2013 07:41PM

For instance:

This works fine on the laptop itself.

<VirtualHost *:80>
    ServerAdmin tim@petri.co.il
    DocumentRoot "C:\wamp\www\emails"
    ServerName test.email.com
    ErrorLog "logs/tim.**REMOVED**.com-error.log"
    CustomLog "logs/tim.**REMOVED**.com-access.log" common
</VirtualHost>

Options: ReplyQuote
Re: Forward external connections to specific directories
Posted by: stevenmartin99 (Moderator)
Date: February 08, 2013 07:42PM

Whats happening when you try from desktop?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Forward external connections to specific directories
Posted by: tspesh (---.hfc.comcastbusiness.net)
Date: February 08, 2013 07:44PM

It just goes to the root directory

Options: ReplyQuote
Re: Forward external connections to specific directories
Posted by: RiggsFolly (---.as13285.net)
Date: February 09, 2013 03:22PM

I assume you vhosts file looks something like this.

	#
	# Use name-based virtual hosting.
	#
	NameVirtualHost *:80

	## must be first so the the wamp menu page loads when you use just localhost as the domain name
	<VirtualHost *:80>
	    DocumentRoot "C:/wamp/www"
	    ServerName localhost
	    Order Deny,Allow
	    Deny from all
    	Allow from 127.0.0.1
    	# You would never want a remote user to see this wamp config page.
	</VirtualHost>

	<VirtualHost *:80>
	    DocumentRoot "C:/websites/site1"
	    ServerName site1.localhost
	    Options Indexes FollowSymLinks
	    <Directory "D:/websrc/www/site1">
			AllowOverride All
			Order Deny,Allow
			Deny from all
			Allow from 127.0.0.1
		    #If you want to allow access from your internal network
		    # For specific ip addresses add one line per ip address
		    #Allow from 192.168.0.100
	    	# For every ip in the subnet, just use the first 3 numbers of the subnet
	    	#Allow from 192.168.1
		</Directory>
	</VirtualHost>

Note if apache cannot find the domain you enter it will default to the first domain in the vhosts file
Thats why you place the wamp stuff first.
So check that your hosts file contains:

127.0.0.1 test.email.com

and of course any other domains you want to be able to access by name

Options: ReplyQuote
Re: Forward external connections to specific directories
Posted by: tspesh (---.hsd1.il.comcast.net)
Date: February 09, 2013 06:16PM

Spectacular thanks!

I had no idea you could do this:
 <Directory "D:/websrc/www/site1">
			AllowOverride All
			Order Deny,Allow
			Deny from all
			Allow from 127.0.0.1
		    #If you want to allow access from your internal network
		    # For specific ip addresses add one line per ip address
		    #Allow from 192.168.0.100
	    	# For every ip in the subnet, just use the first 3 numbers of the subnet
	    	#Allow from 192.168.1
		</Directory>

RiggsFolly Wrote:
-------------------------------------------------------
> I assume you vhosts file looks something like
> this.
>
>
> #
> # Use name-based virtual hosting.
> #
> NameVirtualHost *:80
>
> ## must be first so the the wamp menu page loads
> when you use just localhost as the domain name
>
> DocumentRoot "C:/wamp/www"
> ServerName localhost
> Order Deny,Allow
> Deny from all
> Allow from 127.0.0.1
> # You would never want a remote user to see
> this wamp config page.
>
>
>
> DocumentRoot "C:/websites/site1"
> ServerName site1.localhost
> Options Indexes FollowSymLinks
>
> AllowOverride All
> Order Deny,Allow
> Deny from all
> Allow from 127.0.0.1
> #If you want to allow access from your
> internal network
> # For specific ip addresses add one line per
> ip address
> #Allow from 192.168.0.100
> # For every ip in the subnet, just use the
> first 3 numbers of the subnet
> #Allow from 192.168.1
>
>
>
>
> Note if apache cannot find the domain you enter it
> will default to the first domain in the vhosts
> file
> Thats why you place the wamp stuff first.
> So check that your hosts file contains:
>
> 127.0.0.1 test.email.com
>
> and of course any other domains you want to be
> able to access by name

Options: ReplyQuote


Sorry, only registered users may post in this forum.