[Koha-devel] Apache 2.4 env vars

David Cook dcook at prosentient.com.au
Thu Jan 15 05:24:09 CET 2015


Paul:

Yes, I do believe that I said that Apache ServerName != SERVER_NAME (unless
UseCanonicalName is turned on it seems) :p.

So, I've just gone and run up a new install Koha (via the packages) on a
virtualized Ubuntu 14.04, which uses Apache 2.4.

I just dumped out the SERVER_NAME and SERVER_PORT environmental variables,
and... they had the IP address and the port number 80 in them respectively.
I got the exact same result on OpenSuse using Apache 2.2. 

So if those environmental variables are empty for you... something is
probably wrong with your Apache configuration. 

David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St, Ultimo, NSW 2007

> -----Original Message-----
> From: Paul A [mailto:paul.a at navalmarinearchive.com]
> Sent: Thursday, 15 January 2015 12:01 PM
> To: koha-devel at lists.koha-community.org
> Cc: David Cook; 'Mark Tompsett'
> Subject: RE: [Koha-devel] Apache 2.4 env vars
> 
> At 11:32 AM 1/15/2015 +1100, David Cook wrote:
> >I agree about setting OpacBaseURL. Just set that. C4::Auth should just
> >be using SERVER_NAME and SERVER_PORT as a fall-back.
> >
> >That said, Apache 2.4 really should be automatically setting the
> >SERVER_NAME and SERVER_PORT environmental variables.
> >
> >Paul, how are you accessing this Koha instance? Via a named host or via
> >IP address? I'm guessing that you're just using an IP address...
> 
> David -- thanks. The staff-admin is IP-based, but the OPAC is part of
about a
> dozen name-based VirtualHosts. I could probably IP-base them internally,
> but it makes firewall management a bit more complex.
> 
> >By default, Apache will have the UseCanonicalName set to OFF. It
> >appears that this means that it will populate SERVER_NAME and
> >SERVER_PORT based on what it gets from your client request, rather than
> >the ServerName directive in the Apache conf. Now, if you're using a
> >named host, that won't matter since it'll match the ServerName anyway
> >before setting the environmental variables (I imagine).
> 
> That seems about right... :) and as I said a few minutes ago in my reply
to
> Mark I didn't want to get too deep into re-inventing the wheel.  Note that
for
> Apache ServerName /= SERVER_NAME.
> 
> Best -- Paul
> 
> >
> >
> >However, if you're access it by IP address... I could see it not
> >setting the SERVER_NAME variable. I imagine that SERVER_PORT is still
> being set though.
> >
> >I wouldn't do "SetENV SERVER_NAME" or "SetEnv SERVER_PORT" though.
> The
> >best case is that it won't actually do anything. The worst case is that
> >it will possibly confuse Apache.
> >
> >I might take a moment to test my theory about the named host vs ip
> >address...
> >
> >David Cook
> >Systems Librarian
> >Prosentient Systems
> >72/330 Wattle St, Ultimo, NSW 2007
> >
> > > -----Original Message-----
> > > From: koha-devel-bounces at lists.koha-community.org
> > > [mailto:koha-devel- bounces at lists.koha-community.org] On Behalf Of
> > > Mark Tompsett
> > > Sent: Thursday, 15 January 2015 11:01 AM
> > > To: Paul A
> > > Cc: koha-devel at lists.koha-community.org
> > > Subject: Re: [Koha-devel] Apache 2.4 env vars
> > >
> > > Greetings,
> > >
> > > 1) Why not just set the OPACBaseURL system preference in the first
> place?!
> > >
> > > If you do (1 ), then you don't have to do (2 ), but if you are
> > > crazy,
> >paranoid go
> > > ahead:
> > > 2) /etc/apache2/sites-enabled/koha.conf (or whatever your instance
> > > name
> > > is)
> > >     a) Look for KOHA_CONF and create the appropriate entries for
> > > SERVER_NAME and SERVER_PORT
> > >         For example (yours may differ):
> > >             SetEnv SERVER_NAME library.myDNSname.org
> > >             SetEnv SERVER_PORT 80 # because this should match the
> > > block it
> >is in.
> > >     b) Do step (a ) TWICE (because OPAC and Staff are both in the
> > > same configuration file).
> > >
> > > GPML,
> > > Mark Tompsett
> > >
> > > _______________________________________________
> > > Koha-devel mailing list
> > > Koha-devel at lists.koha-community.org
> > > http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> > > website : http://www.koha-community.org/ git : http://git.koha-
> > > community.org/ bugs : http://bugs.koha-community.org/
> 
> ---
> Maritime heritage and history, preservation and conservation, research and
> education through the written word and the arts.
> <http://NavalMarineArchive.com> and <http://UltraMarine.ca>





More information about the Koha-devel mailing list