Environment variable in Valet Environment variable in Valet nginx nginx

Environment variable in Valet


Since I find this post when I am looking for an answer, it will be easier for me if I leave a note for my self here.

Since I installed nginx using brew, nginx config is located in /usr/local/etc/nginx, and environment variables are already set in fastcgi_params file.

Append to file

/usr/local/etc/nginx/fastcgi_params

a new line, for example

fastcgi_param APP_ENV dev;

If you don't want to set this environment variable globally, it can be overwritten for each site config in ~/.valet/Nginx/site.dev between location ~ \.php$ { closure.