I have tried many of the solutions from: Local installation of Magento 2 doest not generate files in the pub/static folder and similar posts:

I am in developer mode (verified in command line, and I can see error messages on the page for php). I am running Nginx with php-fpm from a 16.04 Ubuntu in vmware.

So far I've tried:

  1. chmod -R 777 on the var and pub folders

  2. chown -R www-data:www-data on the var and pub folders, I've also tried them as owned by root with 777 perms.

  3. tried the suggestion about changing from Symlink to Copy in app/etc/di.xml file

  4. pub/static.php and pub/static/.htaccess I can verify exist and are correct

So I go to the browser (and my browser has cache disabled in network tab) and load a frontend or admin page and none of the pub/static file stuff is generated, the page loads but with no css, js, etc.

If I delete the pub/static I can re-generate them with php bin/magento setup:static-content:deploy and that works fine, but the issue is that anytime I make a change to a template file or js file, I have to delete pub/static and run that command which is very slow and not practical for development. So my questions are:

  1. Any suggestions?

  2. Could this have to do with how I have the owner and group of the Magento files? I am not sure how that should be. It seems like php-fpm runs as www-data but I'm not 100% sure about that, I am not good with linux.

  3. Could it have to be with the user that I use when running php bin/magento setup:static-content:deploy? Which user should that be in command line? Usually I run it as root. But as I mentioned, I've manually changed the pub and var folders and files to www-data but it doesn't help.

  4. Or maybe it has to do with how I have the Mage Root set? I'm using the default nginx.conf file included, and have mage root set like: set $MAGE_ROOT /var/www/html/magento2; (my magento 2 files and folders are in that directory)

  • What are you using to save your changes? To my knowledge you can use this command line interface, Grunt, or Gulp.
    – camdixon
    Oct 11, 2016 at 23:12

2 Answers 2


0) Verify, Are content of js/css files is cached in a browser?

1) Install xdebug and try to debug pub/static.php

2) I am using www-data groups and magento user and 777 for static files.

3) see 2). Do not use root to run static files deploy and do not run it in developer mode. Also, you need clean pub/static folder after setup:static-content:deploy running, because its break automatic redeploy.

4) It looks right

  • 1
    thank you, so I did step 1 about using xdebug and found that pub/static.php was not being used. So I compared my nginx conf to the sample one that comes with Magento, and found that I had accidentally changed the root from root $MAGE_ROOT/pub; to root $MAGE_ROOT; without the pub Oct 13, 2016 at 16:54

php bin/magento setup:static-content:deploy : commmand require to execute if modify files like .css .html .js inside web folder.

It not require to execute after modify any .phtml template or layout file.

If you are change in phtml or layout file, changes not applying then you have to just clean cache using command

php bin/magento cache:clean

Note : No need to re-generate pub/static after change in phtml file just need to clean cache if require.

  • setup:static-content:deploy : commmand is not required
    – KAndy
    Oct 12, 2016 at 6:35

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.