You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Matthew Smith <ch...@gmail.com> on 2010/01/28 20:15:13 UTC

[users@httpd] hitting apache across home network with hosts file

In the past I just had one machine.  I ran apache on it.  I modified the
hosts file to point aliases to the local box.

127.0.0.1 mysite_com So in my browser, I could type in: mysite_com
(underscore instead of dot) and bring up the site. Now I have a new box
running windows 7 that will be the machine I use for dev.  I have assigned
the server a static Ip of 192.168.1.2 and the computer name "server".

I have modified the conf file to listen to ip 192.168.1.2 I have tried to
modify the hosts file on the win 7 machine with the following different
things: server   mysite_com \\server   mysite_com 192.168.1.2   mysite_com
All of these fail to bring up the site.  I can remote desktop to the machine
via its ip or name. What am I doing wrong?

Re: [users@httpd] hitting apache across home network with hosts file

Posted by "Mark H. Wood" <mw...@IUPUI.Edu>.
Since remote desktop can resolve the name, your hosts file should be
correct.  ("192.168.1.2 myhost_com" should work, although if you're
calling that host "server" now then you may want to add that at the
end of the line, after a space.)

Silly question:  you *did* restart HTTPD after updating its
configuration?

Is there anything interesting in HTTPD's logs?  If it thinks it should
be named "server" but couldn't resolve "server" then it may be having
some sort of identity crisis.  Come to think of it, you don't mention
whether you defined "myhost_com" or "server" in etc/hosts *on the server*.

Does the server have a firewall configuration that lets remote desktop
through but not HTTP?

Does 'netstat -a -p tcp' show a listener on 192.168.1.2:80?

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
Friends don't let friends publish revisable-form documents.

Re: [users@httpd] Re: hitting apache across home network with hosts file

Posted by Programmer In Training <pi...@joseph-a-nagy-jr.us>.
On 1/28/2010 8:46 PM, LuKreme wrote:
> On 28-Jan-2010, at 13:08, Matthew Smith wrote:
>>
>> I have modified the windows 7 machine host file to the following:
>> 192.168.1.2 mysite_com
> 
> Is that the correct format for the hosts file in Windos? I seem to recall the Windows host file was 'different'
> 
> Did you verify that the hosts file is in the right location? Check the registry for
> 
> \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath
> 
> and see where it should be.
> 

That is the correct format. It's pretty much exactly the same as *Nix
(I've run both Windows (since 95) and Linux (on and off since RH 6.2,
currently have a FreeBSD 8.0 box)), though I have noticed that Vista and
XP put it in two different locations (e.g. there are two hosts files).

-- 
Yours In Christ,

PIT
Emails are not formal business letters, whatever businesses may want.


[users@httpd] Re: hitting apache across home network with hosts file

Posted by LuKreme <kr...@kreme.com>.
On 28-Jan-2010, at 13:08, Matthew Smith wrote:
> 
> I have modified the windows 7 machine host file to the following:
> 192.168.1.2 mysite_com

Is that the correct format for the hosts file in Windos? I seem to recall the Windows host file was 'different'

Did you verify that the hosts file is in the right location? Check the registry for

\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath

and see where it should be.

-- 
I DID NOT INVENT IRISH DANCING
	Bart chalkboard Ep. 5F03


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] hitting apache across home network with hosts file

Posted by Programmer In Training <pi...@joseph-a-nagy-jr.us>.
On 1/28/2010 2:29 PM, Matthew Smith wrote:
> I understand that.  I am only trying to access the server from the
> windows 7 machine.

Sorry, it sounded like you were trying to access from another machine.

> To clarify:
> server, 192.168.1.2, running apache
> 
> Windows 7 machine, hosts file modified to:
> 192.168.1.2 mysite_com
> Windows 7 machine unable to load http://mysite_com/ in browser

What's the relative bits from your conf file?
-- 
Yours In Christ,

PIT
Emails are not formal business letters, whatever businesses may want.


[users@httpd] Re: hitting apache across home network with hosts file

Posted by Jonesy <gm...@jonz.net>.
On Thu, 28 Jan 2010 14:29:20 -0600, Matthew Smith wrote:
> --0016e6d64956eaf544047e3f60b6
> Content-Type: text/plain; charset=ISO-8859-1
>
> I understand that.  I am only trying to access the server from the windows 7
> machine.
>
> To clarify:
> server, 192.168.1.2, running apache
>
> Windows 7 machine, hosts file modified to:
> 192.168.1.2 mysite_com
> Windows 7 machine unable to load http://mysite_com/ in browser.

hmmmm...
Something un-obvious is working against you....

We are webmasters for a number of web sites here.
They are variously example.com , or .net , or .org

In the hosts file on the windows and linux boxen here we have:

192.168.1.35            www.example.tst example.tst
192.168.1.35            www.example2.tst example2.tst
192.168.1.35            www.example3.tst example3.tst
192.168.1.35            www.example4.tst example4.tst

 for all the various domains -- pointing to a local box running LAMP 
with all the domains replicated thereon.  IJFW here.

Perhaps your browser(s) are attempting to be 'helpful' and are adding 
the ".com" suffix to the truncated domain name in the location bar? (By 
default, most do that.)  That would result in a dns lookup failure.  
Perhaps the error reporting back to you in the browser is not specific 
enough -- telling you it could not find "mysite_com" -- when, indeed, it 
could not find "mysite_com.com".

HTH
Jonesy
-- 
  Marvin L Jones    | jonz          | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
    * Killfiling google & XXXXbanter.com: jonz.net/ng.htm


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] hitting apache across home network with hosts file

Posted by Matthew Smith <ch...@gmail.com>.
I understand that.  I am only trying to access the server from the windows 7
machine.

To clarify:
server, 192.168.1.2, running apache

Windows 7 machine, hosts file modified to:
192.168.1.2 mysite_com
Windows 7 machine unable to load http://mysite_com/ in browser.

On Thu, Jan 28, 2010 at 2:12 PM, Programmer In Training <
pit@joseph-a-nagy-jr.us> wrote:

> On 1/28/2010 2:08 PM, Matthew Smith wrote:
> > I understand that.  I should have made myself more clear.
> >
> > I have modified the windows 7 machine host file to the following:
> > 192.168.1.2 mysite_com
>
> Only requests from the Windows 7 machine will resolve mysite_com to
> 192.168.1.2
>
> Any other machine on the network will have to have their hosts file
> similarly modified.
>
> --
> Yours In Christ,
>
> PIT
> Emails are not formal business letters, whatever businesses may want.
>
>

Re: [users@httpd] hitting apache across home network with hosts file

Posted by Programmer In Training <pi...@joseph-a-nagy-jr.us>.
On 1/28/2010 2:08 PM, Matthew Smith wrote:
> I understand that.  I should have made myself more clear.
> 
> I have modified the windows 7 machine host file to the following:
> 192.168.1.2 mysite_com

Only requests from the Windows 7 machine will resolve mysite_com to
192.168.1.2

Any other machine on the network will have to have their hosts file
similarly modified.

-- 
Yours In Christ,

PIT
Emails are not formal business letters, whatever businesses may want.


Re: [users@httpd] hitting apache across home network with hosts file

Posted by Matthew Smith <ch...@gmail.com>.
I understand that.  I should have made myself more clear.

I have modified the windows 7 machine host file to the following:
192.168.1.2 mysite_com

On Thu, Jan 28, 2010 at 1:26 PM, Programmer In Training <
pit@joseph-a-nagy-jr.us> wrote:

> On 1/28/2010 1:15 PM, Matthew Smith wrote:
> > In the past I just had one machine.  I ran apache on it.  I modified the
> > hosts file to point aliases to the local box.
> >
> > 127.0.0.1 mysite_com So in my browser, I could type in: mysite_com
> > (underscore instead of dot) and bring up the site. Now I have a new box
> > running windows 7 that will be the machine I use for dev.  I have
> > assigned the server a static Ip of 192.168.1.2 and the computer name
> > "server".
> >
> > I have modified the conf file to listen to ip 192.168.1.2 I have tried
> > to modify the hosts file on the win 7 machine with the following
> > different things: server   mysite_com \\server   mysite_com
> > 192.168.1.2   mysite_com All of these fail to bring up the site.  I can
> > remote desktop to the machine via its ip or name. What am I doing wrong?
>
> The hosts file is only for the local machine. It does not redirect to
> another machine nor work on any other machine.
>
> --
> Yours In Christ,
>
> PIT
> Emails are not formal business letters, whatever businesses may want.
>
>

Re: [users@httpd] hitting apache across home network with hosts file

Posted by Programmer In Training <pi...@joseph-a-nagy-jr.us>.
On 1/28/2010 1:15 PM, Matthew Smith wrote:
> In the past I just had one machine.  I ran apache on it.  I modified the
> hosts file to point aliases to the local box.
> 
> 127.0.0.1 mysite_com So in my browser, I could type in: mysite_com
> (underscore instead of dot) and bring up the site. Now I have a new box
> running windows 7 that will be the machine I use for dev.  I have
> assigned the server a static Ip of 192.168.1.2 and the computer name
> "server".
> 
> I have modified the conf file to listen to ip 192.168.1.2 I have tried
> to modify the hosts file on the win 7 machine with the following
> different things: server   mysite_com \\server   mysite_com
> 192.168.1.2   mysite_com All of these fail to bring up the site.  I can
> remote desktop to the machine via its ip or name. What am I doing wrong?

The hosts file is only for the local machine. It does not redirect to
another machine nor work on any other machine.

-- 
Yours In Christ,

PIT
Emails are not formal business letters, whatever businesses may want.