.htacces-SetEnvIf To NGinx-fastcgi_param Conversion

I have below .htaccess options along with my Apache site; I will now move on to Nginx. So I am wondering how can I put the parameters 'SetEnvIf' into the .htaccess file for Nginx configuraiton? I think by setting "fastcgi_param", please help me do the conversion.

SetEnvIf HOST albany\.mywebsite\.com MAGE_RUN_CODE=w2760 SetEnvIf HOST albany\.mywebsite\.com MAGE_RUN_TYPE=website SetEnvIf HOST alexandria\.mywebsite\.com MAGE_RUN_CODE=w1472 SetEnvIf HOST alexandria\.mywebsite\.com MAGE_RUN_TYPE=website SetEnvIf HOST annarbor\.mywebsite\.com MAGE_RUN_CODE=w2933 SetEnvIf HOST annarbor\.mywebsite\.com MAGE_RUN_TYPE=website 

Thanks.

+4
source share
1 answer

you can do it like this:

 if ($host = albany.mywebsite.com) { env MAGE_RUN_CODE=w2769; env $MAGE_RUN_TYPE=website; } 

(and so on for other host values)

see http://nginx.org/en/docs/ngx_core_module.html#env

+5
source

Source: https://habr.com/ru/post/1432863/


All Articles