Skip to content

Instantly share code, notes, and snippets.

@sadovnik
Created February 6, 2017 12:49
Show Gist options
  • Save sadovnik/5bf0170c3e15cc5f820cf045b553a20a to your computer and use it in GitHub Desktop.
Save sadovnik/5bf0170c3e15cc5f820cf045b553a20a to your computer and use it in GitHub Desktop.
How to pass an environment variable from Nginx to PHP
location ~ \.php$ {
# Variable FOO_ENV_VARIABLE with value "bar"
fastcgi_param FOO_ENV_VARIABLE bar;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment