1

Simply, I want to achieve same thing of apache vhosts: Set Application_ENV via virtual host config and read this in PHP for nginx. How to do that?

evilReiko
  • 19,501
  • 24
  • 86
  • 102

1 Answers1

0

One way to do it is use fastcgi_param as answered here and here.

I prefered another method. Since I'm using GIT as my VCS:

  1. I created a file in the root of my project named it "env.conf", which contains only 1 string ("production", "development", etc) which is the environment name
  2. Ignored this file in .gitignore.
  3. Read the file and check the value as the first thing in my application starting point.
evilReiko
  • 19,501
  • 24
  • 86
  • 102