Many blogs suggest putting your variables in /etc/environment
and including that file in /etc/apache2/envvars
, but that solution did not work for me. After hours of searching and testing, this is what I came up with. I figured others may find it useful.
Environment: Ubuntu 16.04, Apache 2.4
Append the following to your site's .gitignore
file so that you don't accidentally commit your environment variables.