-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add Nginx configuration to environment variables #7044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,8 @@ applied to the resulting parameter name: | |
* Double underscores are replaced with a period, as a period is not | ||
a valid character in an environment variable name. | ||
|
||
For example, if you're using Apache, environment variables can be set using | ||
the following ``VirtualHost`` configuration: | ||
For example, if you're using Apache, environment variables can be set using the | ||
`SetEnv`_ directive with the following ``VirtualHost`` configuration: | ||
|
||
.. code-block:: apache | ||
|
||
|
@@ -40,13 +40,41 @@ the following ``VirtualHost`` configuration: | |
</Directory> | ||
</VirtualHost> | ||
|
||
For Nginx web servers, the environment variables can be set with `fastcgi_param`_ | ||
directive. For example in the configuration file where the ``fastcgi_params`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, in [...] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, is the part about the included There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
file is included: | ||
|
||
.. code-block:: nginx | ||
|
||
server { | ||
server_name domain.tld www.domain.tld; | ||
root /var/www/project/web; | ||
|
||
location / { | ||
try_files $uri /app.php$is_args$args; | ||
} | ||
|
||
location ~ ^/app\.php(/|$) { | ||
fastcgi_pass unix:/var/run/php5-fpm.sock; | ||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
fastcgi_param DOCUMENT_ROOT $realpath_root; | ||
fastcgi_param SYMFONY__DATABASE__USER user; | ||
fastcgi_param SYMFONY__DATABASE__PASSWORD secret; | ||
internal; | ||
} | ||
|
||
# ... | ||
} | ||
|
||
.. note:: | ||
|
||
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 examples above are for an Apache and Nginx configuration. However, this | ||
will work for any web server which supports the setting of environment | ||
variables. | ||
|
||
Also, in order for your console to work (which does not use Apache), | ||
Also, in order for your console to work (which does not use web server), | ||
you must export these as shell variables. On a Unix system, you can run | ||
the following: | ||
|
||
|
@@ -148,3 +176,4 @@ the Symfony service container. | |
$container->setParameter('drupal.database.url', $db_url); | ||
|
||
.. _`SetEnv`: http://httpd.apache.org/docs/current/env.html | ||
.. _`fastcgi_param`: http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_param |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...] with the
fastcgi_param
[...]