I can't enable Profiler on nginx. I have already added this line: set $MAGE_PROFILER html to file devmagento2.conf, but nothing was happened. I also have tried to add this line: $_SERVER['MAGE_PROFILER'] = 'html' to file index.php, with the same result.

Can you help me with this issue?

  • i can only recommend the mirasvit/profiler module when you use nginx, worked for me. you can find the module on github
    – juhanix
    Commented Sep 7, 2017 at 15:28

1 Answer 1


For ngnix you have to write

fastcgi_param  MAGE_PROFILER html 

into ngnix.conf file, you will find below code.

File : ngnix.conf

#PHP entry point for main application 
location ~ (index|get|static|report|404|503)\.php$ {
try_files $uri =404;
fastcgi_pass   fastcgi_backend;
fastcgi_buffers 1024 4k;

fastcgi_param  PHP_FLAG  "session.auto_start=off \n     suhosin.session.cryptua=off";
fastcgi_param  PHP_VALUE "memory_limit=768M \n max_execution_time=600";
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
# to configure profiler in Magento 2

fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
include        fastcgi_params;

set $MAGE_PROFILER html; this variable value can be set in virtual host config file or directly you can set html in place of variable $MAGE_PROFILER. /etc/ngnix/conf.d/

server {
listen 80;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/local/local.pem;
ssl_certificate_key /etc/ssl/certs/local/local.key;
server_name example.com;    
set $MAGE_MODE developer;
set $MAGE_PROFILER html;
include /example.com/html/www/nginx.conf;
  • you saved my day :)
    – Ahmed Z.
    Commented Mar 5, 2018 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.