I am using Capistrano to deploy Magento code to a webserver that is running nginx. Nginx web root for test.url.com is /var/www/html, which on the filesystem is a symlink to /opt/magento-codebase/current (which in itself is a symlink to /opt/magento-codebase/releases/TIMESTAMP). See http://capistranorb.com/documentation/getting-started/structure for more details on how Cap. sets up its directories.

Everything loads right, except for assets described in Magento's layout XML files. When generating the URLs via the Mage_Page_Block_Html_Head::addItem() method it ends up including the full path to the file in the URL. For example, <action method="addItem"><type>skin_css</type><name>css/tools.css</name></action> results in:


should be


Is there an nginx or Magento configuration I can use to tell it not to include the resolved directory? I'm testing this locally and we are not combining JS assets or CSS assets into the hashed file stored in /media yet.

Update: I checked and when dev/js/merge_files is set to 1 and dev/css/merge_css_files is set to 1 in core_config_data, it doesn't work. WhenI set them to 0, it loads correctly...


Whenever I encounter this problem (not as part of Capistrano deployments), I can quickly resolve by:

  • Turning off CSS merge
  • Flushing cache storage
  • Or, flushing CSS/JS cache
  • Turning on CSS merge

Sounds like you were onto this already, but to be sure were you flushing cache in between settings changes?

| improve this answer | |

The problem turned out to be permissions in the shared media and var folders. Once I set the group for those folders to be nginx and add the bamboo user to the nginx group, it worked as expected.

| improve this answer | |

Its a magento bug, you can open a support ticket and request the PATCH_SUPEE-2662_EE_1.13.1.0_v1 patch.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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