Set parameters for Apache or Nginx
This section discusses how to specify the mode for either Apache or Nginx.
Nginx setting
See the Nginx sample configuration on GitHub.
Apache .htaccess setting
One way to set the application mode is by editing .htaccess
. This way, you do not have to change Apache settings.
You can modify .htaccess
in any of the following locations, depending on your entry point to the Commerce application:
<magento_root>/.htaccess
<magento_root>/pub/.htaccess
To set a variable:
-
Open any of the preceding files in a text editor and either add or uncomment the desired setting.
For example, to specify a mode, uncomment the following:
# SetEnv MAGE_PROFILER firebug
-
Set the value of
MAGE_PROFILER
to any of the following:firebug csvfile <custom value>
-
Save your changes to
.htaccess
; you do not need to restart Apache for the change to take effect.
Apache setting
The Apache web server supports setting the application mode using mod_env
directives.
The Apache mod_env
directive is slightly different in Apache version 2.2 and Apache version 2.4.
The procedures that follows show how to set the application mode in an Apache virtual host. This is not the only way to use mod_env
directives; consult the Apache documentation for details.
To Specify a bootstrap variable for Apache on Ubuntu:
-
As a user with
root
privileges, open your virtual host configuration file in a text editor.For example, if your virtual host is named
my.magento
,- Apache 2.4:
vim /etc/apache2/sites-available/my.magento.conf
- Apache 2.2:
vim /etc/apache2/sites-available/my.magento
- Apache 2.4:
-
Anywhere in the virtual host configuration, add the following line:
SetEnv "<variable name>" "<variable value>"
For example,
SetEnv "MAGE_PROFILER" "firebug"
-
Save your changes and exit the text editor.
-
Enable your virtual host if you have not already done so:
a2ensite <virtual host config file name>
For example,
a2ensite my.magento.conf
-
After setting the mode, restart the web server:
- Ubuntu:
service apache2 restart
- CentOS:
service httpd restart
- Ubuntu:
To specify a bootstrap variable for Apache on CentOS:
-
As a user with
root
privileges, open/etc/httpd/conf/httpd.conf
in a text editor. -
Anywhere in the virtual host configuration, add the following line:
SetEnv "<variable name>" "<variable value>"
For example,
SetEnv "MAGE_PROFILER" "firebug"
-
Save your changes and exit the text editor.
-
After setting the mode, restart the web server:
- Ubuntu:
service apache2 restart
- CentOS:
service httpd restart
- Ubuntu: