Skip to content

BestPractices doc recommends using env vars for 'sensitive options', points to example URL, but does not provide any info for Nginx #5196

Closed
@ghost

Description

The Symfony "Best Practices" docs at

http://symfony.com/doc/current/best_practices/configuration.html

recommend

Moving Sensitive Options Outside of Symfony Entirely

    When dealing with sensitive options, like database credentials, we also recommend that you store them outside the Symfony project and make them available through environment variables.

And point to

Learn how to do it in the following article: How to Set external Parameters in the Service Container

Following/Reading at

How to Set external Parameters in the Service Container 
http://symfony.com/doc/current/cookbook/configuration/external_parameters.html 

the docs provide an example for setting EnvVars for use when using Apache

"For example, if you're using Apache, environment variables can be set using the following VirtualHost configuration: ..."

but avoid any example sufficient and correct for nginx, stating only

"The example above is for an Apache configuration, using the SetEnv directive. However, this will work for any web server which supports the setting of environment variables."

The nginx/env pieces are here

https://docs.apitools.com/blog/2014/07/02/using-environment-variables-in-nginx-conf.html
http://nginx.org/en/docs/http/ngx_http_perl_module.html#perl_set
http://nginx.org/en/docs/ngx_core_module.html#env

But there needs to be a good nginx example -- that works -- to properly provide ENV vars so that

"Symfony will grab any environment variable prefixed with SYMFONY__ and set it as a parameter in the service container"

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions