09-09-06 12:23 AM
I'm having trouble getting apache2 to set env variables like SERVER_NAME
the way I expect.
I have apache2 on simple ubuntu/debian server on a home lan behind an
adsl nat/router.
It is just a test box for my "real" site which is hosted externally. I
only need to access it locally, ie no access from the internet.
I use a "dummy" domain name = "home.lan" which is not exposed to the
internet. My hostname is set to "server3.home.lan" and hostname and
hostname -f both show this correctly.
I am not using virtual hosts, so I just have the main server and in
apache2.conf I set: ServerName server3.home.lan:80
I am NOT using any dns for the home lan, so to access the server I point
to it using the ip address.
Now pretty much everything works just fine, but I have some problems
with some specific php scripts that use apache environment variables.
Using phpinfo() to compare my hosted server with my home server I see
that variables like SERVER_NAME are set to the IP address not fqdn.
Is this because I accessed the site by IP address rather than name?
Or am I missing something in the setup ? The phpinfo output shows the
correct fqdn in the apache2handler section ... and so it seems apache
has detected my hostname/domainname correctly.
Also the hostname seems to be seen correctly by other application
(Postfix for example). It's just apache I'm having trouble with.
I even tried using the SetEnv directive to "force" the variable to the
right value. This works to set a new variable but no surprise this
wouldn't override a standard variable like SERVER_NAME.
Any suggestions where to look?
If the answer is that I have to set up a dns server then that's new
ground for me, can anyone point me to a "howto" that would help me build
a bare minimum setup ... I really only need it to solve this particular
issue.
[ Post a follow-up to this message ]
|