httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Lester" <...@ajltech.co.uk>
Subject [users@httpd] SERVER_ADDR "does not exist"
Date Tue, 18 Feb 2014 10:55:16 GMT
Please accept my apologies for popping up on the list with an immediate
question, and even more so if it turns out that I am being stupid, but
this one really does have me confused. I have read the manuals and
searched and searched, but can't seem to find any reference to anyone else
having the same problem, or any related bug reports.

I am using Apache 2.4.7 (full details below).

The machine has two network interfaces with separate IP addresses, and I
want to use a conditional statement in the conf file of the default
virtual host to handle traffic coming in via the two IP's differently
using SERVER_ADDR to identify them. What I expected to be the complicated
bit all works fine, but this construct:
     <If "%{SERVER_ADDR} == '<ip address of 2nd interface>'">
           .......
     </If>
     <Else>
           .......
     </Else>
results in this:

root@mymachine:apache2# ./bin/apachectl restart
AH00526: Syntax error on line 118 of
/usr/local/apache2/conf/extra/configfile.conf:
Cannot parse condition clause: Variable 'SERVER_ADDR' does not exist
root@mymachine:apache2#

I have created a page where SSI tells me all the environment variables,
and SERVER_ADDR is there alright, a full list is below.

If, in my conf file, I change SERVER_ADDR to other variables including:
   HTTP_HOST;
   SERVER_NAME;
   REMOTE_ADDR; and
   SERVER_PORT,
apache restarts fine and conditional behaviour is as expected in those
instances. It just seems to be SERVER_ADDR which isn't working. In a
desperate attempt to find out what was going on, I even put a:
   SetEnv SERVER_ADDR <ip address>
higher up the file, but the same error still came back.

Am I missing something and/or does this work for other people?

Supplemental information about my system follows.
----------------------------------------------------------

My apache installation details are as follows:
   Server version: Apache/2.4.7 (Unix)
   Server built:   Feb 11 2014 17:07:38
   Server's Module Magic Number: 20120211:27
   Server loaded:  APR 1.4.6, APR-UTIL 1.4.1
   Compiled using: APR 1.4.6, APR-UTIL 1.4.1
   Architecture:   64-bit
   Server MPM:     worker
     threaded:     yes (fixed thread count)
       forked:     yes (variable process count)
   Server compiled with....
    -D APR_HAS_SENDFILE
    -D APR_HAS_MMAP
    -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
    -D APR_USE_SYSVSEM_SERIALIZE
    -D APR_USE_PTHREAD_SERIALIZE
    -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    -D APR_HAS_OTHER_CHILD
    -D AP_HAVE_RELIABLE_PIPED_LOGS
    -D DYNAMIC_MODULE_LIMIT=256
    -D HTTPD_ROOT="/usr/local/apache2"
    -D SUEXEC_BIN="/usr/local/apache2/bin/suexec"
    -D DEFAULT_PIDLOG="logs/httpd.pid"
    -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
    -D DEFAULT_ERRORLOG="logs/error_log"
    -D AP_TYPES_CONFIG_FILE="conf/mime.types"
    -D SERVER_CONFIG_FILE="conf/httpd.conf"

It's running on Debian Wheezy, but is installed from source, not via a
Debian package.

The full list of my environment variables according to SSI is:
     HTTPS
     HTTP_HOST
     HTTP_USER_AGENT
     HTTP_ACCEPT
     HTTP_ACCEPT_LANGUAGE
     HTTP_ACCEPT_ENCODING
     HTTP_CONNECTION
     PATH
     LD_LIBRARY_PATH
     SERVER_SIGNATURE
     SERVER_SOFTWARE
     SERVER_NAME
     SERVER_ADDR
     SERVER_PORT
     REMOTE_ADDR
     DOCUMENT_ROOT
     REQUEST_SCHEME
     CONTEXT_PREFIX
     CONTEXT_DOCUMENT_ROOT
     SERVER_ADMIN
     SCRIPT_FILENAME
     REMOTE_PORT
     GATEWAY_INTERFACE
     SERVER_PROTOCOL
     REQUEST_METHOD
     QUERY_STRING
     REQUEST_URI
     SCRIPT_NAME
     DATE_LOCAL
     DATE_GMT
     LAST_MODIFIED
     DOCUMENT_URI
     USER_NAME
     DOCUMENT_NAME

----------------------------------------------------------

Many thanks in advance for any help which can be given,

Adrian







---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message