diff --git a/cookbook/en/configuring-webservers/apache.md b/cookbook/en/configuring-webservers/apache.md index dc74d110..e756e521 100644 --- a/cookbook/en/configuring-webservers/apache.md +++ b/cookbook/en/configuring-webservers/apache.md @@ -20,6 +20,8 @@ DocumentRoot "path/to/app/public" # Otherwise forward the request to index.php RewriteRule . index.php + + SetEnv APP_ENV dev # ...other settings... @@ -42,5 +44,10 @@ RewriteCond %{REQUEST_FILENAME} !-d # Otherwise forward the request to index.php RewriteRule . index.php +SetEnv APP_ENV dev + # ...other settings... ``` + +In the above, note the usage of `SetEnv`. Since the Yii3 application template is using environment variables, this is a possible +place to set them. In production environment remember to set `APP_ENV` to `prod`. diff --git a/cookbook/en/configuring-webservers/iis.md b/cookbook/en/configuring-webservers/iis.md index 63943389..2eb720bb 100644 --- a/cookbook/en/configuring-webservers/iis.md +++ b/cookbook/en/configuring-webservers/iis.md @@ -8,23 +8,23 @@ Use the following content: ```xml - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + ``` diff --git a/cookbook/en/configuring-webservers/nginx-unit.md b/cookbook/en/configuring-webservers/nginx-unit.md index 11b7af8d..f052615f 100644 --- a/cookbook/en/configuring-webservers/nginx-unit.md +++ b/cookbook/en/configuring-webservers/nginx-unit.md @@ -41,6 +41,9 @@ Here is a sample configuration. "yii": { "type": "php", "user": "www-data", + "environment": { + "APP_ENV": "dev" + }, "targets": { "direct": { "root": "/path/to/app/public/" @@ -58,3 +61,6 @@ Here is a sample configuration. You can also [set up](https://unit.nginx.org/configuration/#php) your PHP environment or supply a custom `php.ini` in the same configuration. + +In the above, note the usage of `environment`. Since the Yii3 application template is using environment variables, +this is a possible place to set them. In production environment remember to set `APP_ENV` to `prod`. diff --git a/cookbook/en/configuring-webservers/nginx.md b/cookbook/en/configuring-webservers/nginx.md index fea28339..7d1eca5e 100644 --- a/cookbook/en/configuring-webservers/nginx.md +++ b/cookbook/en/configuring-webservers/nginx.md @@ -41,6 +41,7 @@ server { fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php8-fpm.sock; try_files $uri =404; + fastcgi_param APP_ENV "dev"; } location ~* /\. { @@ -54,3 +55,6 @@ to avoid many unnecessary system `stat()` calls. Also, note that when running an HTTPS server, you need to add `fastcgi_param HTTPS on;` so that Yii can detect if a connection is secure. + +In the above, note the usage of `fastcgi_param APP_ENV`. Since the Yii3 application template is using environment variables, +this is a possible place to set them. In production environment remember to set `APP_ENV` to `prod`.