rryqszq4 / ngx-php

ngx-php - Embedded php7 or php8 scripting language for nginx module. Mainline development version of the ngx-php.
BSD 2-Clause "Simplified" License
586 stars 56 forks source link

Question: set $_SERVER variables #3

Open lykhouzov opened 6 years ago

lykhouzov commented 6 years ago

Hello, How it's possible to set $_SERVER variables for example for general usage of fastcgi

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

how should it be for the module?

Thank you.

rryqszq4 commented 5 years ago

@lykhouzov I am not sure if these are what you want.

location ~ \.php$ {
            set $faker_root /home/www/htm;
            access_by_php '
                ngx_var::set("faker_root","/home/www/html");
            ';
            root           /home/www/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  $faker_root$fastcgi_script_name;
            include        fastcgi_params;
        }