Page 1 of 1

accessing my website on local network

Posted: Mon Sep 12, 2005 11:37 am
by sweenyman
Hi
Up until now I was quite happily using my machine with php/mysql/apache and everything was fine. I accessed my pages as usual with http:// localhost/mywebsite/index.php etc. Now i've networked 2 computers what do I type in the address bar of the new computer to access my old machine with my website. If I use localhost the machine thinks its referring to itself (localhost). The answer is probably staring me in the face but I'm looking the other way :(

Sweenyman

Posted: Mon Sep 12, 2005 11:39 am
by BDKR
What's the IP address of your old machine?

accessing web pages locally

Posted: Mon Sep 12, 2005 11:57 am
by sweenyman
BDKR wrote:What's the IP address of your old machine?
Thanks for your prompt reply.

I looked on a website and it told me it was 195.218.107.82

The last 2 numbers seem to change. Where would I find my IP adress on my PC?

Thanks

Sweenyman

Posted: Mon Sep 12, 2005 12:34 pm
by s.dot
Several IP addresses might work for you..

127.0.0.1 - should be the same as local host
Open a command prompt, type ipconfig, you should see an IP address along with other network settings.
http://www.myipaddress.com/ , this could give you an external IP address to your computer, rather than within your network.

If you're on dial up, your IP address will be dynamic. However if you're on a permanent connection, or one such as cable or DSL, you will have a static IP address.

Also, make sure your router has a port open for viewing webpages (usually port 80)

Posted: Mon Sep 12, 2005 12:54 pm
by sweenyman
scrotaye wrote:Several IP addresses might work for you..

127.0.0.1 - should be the same as local host
Open a command prompt, type ipconfig, you should see an IP address along with other network settings.
http://www.myipaddress.com/ , this could give you an external IP address to your computer, rather than within your network.

If you're on dial up, your IP address will be dynamic. However if you're on a permanent connection, or one such as cable or DSL, you will have a static IP address.

Also, make sure your router has a port open for viewing webpages (usually port 80)
Right, I found ip address using ipconfig, thanks for that. So now should I type in the address bar something like.
http://195.126.0.5/localhost/mysite/index.php, where the ip address is that of my old computer where the website lives.

Thanks
Sweenyman

Posted: Mon Sep 12, 2005 1:12 pm
by BDKR
Let us know how it worked out.

Posted: Mon Sep 12, 2005 2:35 pm
by sweenyman
BDKR wrote:Let us know how it worked out.
No. That does not seem to work. Just get cant find page error.
Do you think that the address syntax above is correct? If I was sure that this was the right thing to do then I might look at other things like permissions etc

sweenyman

Posted: Mon Sep 12, 2005 3:08 pm
by BDKR
Errr...., are you trying to use ....
? If so, that's not going to work. Take the localhost part out then try.

Cheers

Posted: Mon Sep 12, 2005 3:41 pm
by sweenyman
BDKR wrote:Errr...., are you trying to use ....
? If so, that's not going to work. Take the localhost part out then try.

Cheers
No doesn't work, the thing is that the new computer that I have networked wouldn't know where my root folder was for serving out the webpages ie wwwroot in the apache folder. On my original machine, it was configured to know that 'localhost' meant C/apache/htdocs or whatever.......or am I getting the "wrong end of the stick"?
I suppose i mean basically that I need the apache web server on my old machine to serve webpages to my new computer.

Hope that makes sense

Thanks
Sweenyman

Posted: Mon Sep 12, 2005 9:34 pm
by BDKR
sweenyman wrote: I suppose i mean basically that I need the apache web server on my old machine to serve webpages to my new computer.

Hope that makes sense
Wow! You're a hardcore Apache noob! :lol:

Normally Apache will serve pages to any computer that hits it at the right IP address and port. Let's just forget all about ports
for the time being. If your old machine with the Apache server is at 192.168.0.X, then any machine on the same network should
have access to your old machine via it's IP address. That said, it doesn't matter what your document root is ( c:/apache/htdocs
as an example ). All that's needed by any other computer is the correct IP address.
sweenyman wrote: On my original machine, it was configured to know that 'localhost' meant C/apache/htdocs or whatever.......
Actually, it was configured to know that localhost was the same thing as your IP address. Localhost does not refer to the document
root of a web server. Localhost refers to 127.0.0.1.

What is the IP address of your new computer?

Posted: Mon Sep 12, 2005 9:45 pm
by 127.0.0.1
Could be a router issue.

Do you have nat enabled?

can you ping from and to between the two pc's?

Posted: Mon Sep 12, 2005 10:06 pm
by John Cartwright
or a firewall issue

Posted: Tue Sep 13, 2005 3:31 am
by timvw
A couple of important settings in my httpd.conf

Code: Select all

Listen 80

LoadModule php5_module "C:/Program Files/php-5.0.5-Win32/php5apache2.dll"
PHPIniDir "C:/Program Files/php-5.0.5-Win32/"
AddType application/x-httpd-php .php

ServerName localhost:80
UseCanonicalName Off


NameVirtualhost *:80

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot "F:/websites/localhost"
  <Directory "F:/websites/localhost">
    AllowOverride All
    Options All
  </Directory>
</Virtualhost>

<VirtualHost *:80>
  ServerName test
  DocumentRoot "F:/websites/test"
  <Directory "F:/websites/test">
    AllowOverride All
    Options All
  </Directory>
</Virtualhost>
Now, if i have on a different machine the following in my c:/windows/system32/drivers/etc/hosts i can surf to http://test from there...

Code: Select all

192.168.1.11        test

Posted: Tue Sep 13, 2005 2:57 pm
by sweenyman
Jcart wrote:or a firewall issue
Phew!

Yip it was a firewall problem. I had to allow Apache as an exception in the "exceptions tab" of the firewall.
Thank for all the help

Sweenyman