How to combine text and variables in fastcgi_param?

naxa anaxagramma at
Sun Feb 23 12:59:39 UTC 2014

Hello there dear nginx people,

I am a beginner in nginx and also to mailing lists. :) Once read the
docs I can't say I am sure I remember all the important parts so please
excuse me if I am asking something silly. I'm having trouble with using
the `value` part `fastcgi_param` of ngx_http_fastcgi. I am using nginx
I am trying to include four spaces between two variables. Here is an
example in markdown. This is cross-posted at

The [fastcgi_param

> A value can contain text, variables, and their combination.

Does not link or specify explicitly what the text format is or what the
combination format is.

I am trying to add four spaces between two variables in order to
understand the 'expression format' used in `fastcgi_param`. I get
errors. Here are relevant parts from `nginx.conf` with line numbers:

# try 1 with apostrophe `'`

    78: fastcgi_param  SCRIPT_FILENAME  $document_root'   
    82: # deny access to .htaccess files, if Apache's document root


    nginx: [emerg] unexpected "s" in <nginx.conf>:82

# try 2 (bare)
Another try

    78: fastcgi_param  SCRIPT_FILENAME  $document_root   


    nginx: [emerg] invalid parameter "$fastcgi_script_name" in

# try 3 with double quotse `"`

If I use `"` like this:

    78: fastcgi_param  SCRIPT_FILENAME  $document_root"   

the error I get is:

    nginx: [emerg] unexpected end of file, expecting ";" or "}" in

If I simply do

    78: fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

as usual, it works, *so I believe there is no other error in my*

Tried to look up the
but due to its generalized nature, I couldn't yet find where the parse
and variable substitution is actually done.

How do I mix text and variables in a free-form way with nginx, in
particular in the value part of `fastcgi_param`?

I am using **nginx 1.2.5**.

Thank you,

More information about the nginx mailing list