Forum Moderators: coopster
I am new to PHP and webstuff but I think I am doing ok, except for one thing. Which is where I need your help:
I have set up an apache (2.0) server, with mysql and PHP. It resides on a computer that is part of local network which is placed behind a router. Nothing strange I think.
Now, I want to access the server from within the lan as well as from the internet. And here is where my problem is.
In the php configuration file, one must set the variable $mosConfig_live_site. (I dont have a real www name so I use the ip).
If I set that one to [10.0.0.150...] (the ip address of the server within the lan) I can access the server from other computers in the lan but NOT from the internet. (It times out, because for a client 10.0.0.150 doesnt mean anything...)
If I set it to the (routers ip) lets say [80.156.x.65...] then I can access the server from the internet but not from my lan-computers. (Strange I think, because 80.156.x.65 should somehow be relayed via my ISP back to my router and then to my server.. I think.)
(I already made sure that internet clients accessing 80.156.x.65 will be relayed to 10.0.0.150 using NAT.)
I tried to add an ip route so that 10.0.0.150 would be relayed to 80.156.x.65 but that doesnt work (or I did it wrong). NAT only seems to work for converting internet IP:Port to lan IP:Port. Or am I wrong here too?
I am really stuck now, anyone knows how to solve this problem?
Thanks in advance,
Marck
(Off topic, it wouldnt be a big problem if it weren't for all the php code using $mosConfig_live_site as a reference to files instead of $mosConfig_absolute_path.....)
And of course, 80.156.x.65 is just a random IP, its not mine.
[edited by: jatar_k at 5:10 pm (utc) on May 10, 2004]
[edit reason] generalized [/edit]
In my experience, most routers are not able to have LAN traffic that references the IP of the router route back into the local network.. though some routers can. Your router likely does not do this.
I think your best bet really is to have a host name registered. If purchasing one is an issue, try using one of the many dynamic DNS services available. You can configure a dynamic DNS name to resolve to the public IP (router IP), and then you can configure either a local DNS server or the hosts file on the local machines to resolve to the local IP address.
In this way, everyone, local and remote users, will be able to access the site using name.domain.com.
Your answer definitly helped me. I just got DNS from www.dyndns.org and followed your instructions.
I changed the hosts files on all three the comps (instead of trying to set the DNS' in the router).
It works :-) Thanks again. Problem solved.
Next question, just for the fun of it: is it possible to have the ip's switched using the host file?
i.e. instead of : x.x.x.x some.dns.com
do x.x.x.x y.y.y.y
Ah well, I just try maybe it works, who knows.
Grtz,
Marck