performance using variables?

Ingo Baab ib at
Tue May 2 12:03:25 UTC 2017

Hello List!

I got a question regarding performance of my nginx configuration files 
using variables.
Will there be any slow LUA-runtime-parsing if I set a variable $phpuser 
inside my server
block and use it afterwards in several common config files.

Q: Is this a performance disadvantage?

    upstream php7_wpexpress_de {
       server unix:/var/run/php7.0-fpm-wpexpress_de.sock;

    server {
         set $phpuser "wpexpress_de";


         access_log /var/log/nginx/ rt_cache;
         error_log /var/log/nginx/;

         root /var/www/;

         index index.php index.html index.htm;

         include common/redis-php7.conf;
         include common/wpcommon-php7.conf;
         include common/locations-php7.conf;

In the bottom (three) included config-files I subsequently use

        fastcgi_pass php7_$phpuser;

because they do not distinguish per virtual host except for the 
Is this a good approach to separate php processors for each virtual host 
or should
I do all configuration better static? Thank you in advance for any 
helpfull information,

Ingo Baab,
I did read: and 
also found guys suggesting a global var with nginx-config utilizing map: 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list