logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: local ip -> public ip
Author
pedroz



Joined: 16 Aug 2007
Posts: 3

PostPosted: Thu 16 Aug '07 18:41    Post subject: local ip -> public ip Reply with quote

I have my apache server running perfectly with the following configuration.

Internet
|
Router – xxx.xxx.xxx.xxx [public ip]… DMZ to 192.168.0.5
|
Server – 192.168.0.5 [local ip] … apache 2.0.x with <virtualhost domain.com >

C:\WINDOWS\system32\drivers\etc\hosts 127.0.0.1 domain.com


… It is running perfectly but I would like to ask this
When I run www.domain.com/phpinfo.php [phpinfo() command] I get the following:
_SERVER["SERVER_ADDR"] = 192.168.0.5

It is correct because it is the local ip of the server but…
Is there any chance to emulate in apache the public ip like
_SERVER["SERVER_ADDR"] = xxx.xxx.xxx.xxx [public server] ???
I am only testing this and my router is a Webstar with a home internet connection, but if it would possible to emulate the server address to a public ip it would be interesting.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Fri 17 Aug '07 9:02    Post subject: Reply with quote

The $_SERVER["SERVER_ADDR"] always contains IP of the networkcard you should use $_SERVER["HTTP_HOST"] which contains the requested host. So if you call it from outside there is your domain name (if you have one over DNS). From inside there can be the name of the PC or the internal IP.
Back to top
poetics5



Joined: 31 Aug 2007
Posts: 6
Location: all over

PostPosted: Fri 31 Aug '07 4:39    Post subject: Reply with quote

I don't know if you care or not, but instead of running your router as dmz you could just do port forwarding.

forward port 80 to the ip of your apache machine, and then just configure apache to listen on that port.
Back to top
drizzitwill



Joined: 18 Sep 2007
Posts: 4
Location: Idaho

PostPosted: Tue 18 Sep '07 3:16    Post subject: ? Reply with quote

when you type 'www' into an address you are directing out to the web
try just http://localhost/phpinfo.php
exclude the 'www'
Back to top


Reply to topic   Topic: local ip -> public ip View previous topic :: View next topic
Post new topic   Forum Index -> Apache