prob with apache2 and hostname/servername env variables
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Web Servers on Unix and Linux > prob with apache2 and hostname/servername env variables




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    prob with apache2 and hostname/servername env variables  
Geoff


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
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 ]



    Re: prob with apache2 and hostname/servername env variables  
Max Dittrich


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-09-06 06:17 PM

Hi,

Am Fri, 08 Sep 2006 21:47:38 GMT schrieb Geoff:

> 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?

Check the value of "UseCanonicalName" in your configuration. Setting it to
"On" may fix your problem.

See http://httpd.apache.org/docs/2.0/mo...secanonicalname for
details.

.max





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:38 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register