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?
Asked
Active
Viewed 2,065 times
1 Answers
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:
- 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
- Ignored this file in .gitignore.
- Read the file and check the value as the first thing in my application starting point.

evilReiko
- 19,501
- 24
- 86
- 102