Search code examples
apachesymfonyasseticcloudcontrol

Apache configuration for cloudControl w/ Symfony2 and Assetic?


I'm having problems to show my generated assets in cloudControl. After assetic:dump the assets are created un the /srv/www/code/web folder but Apache is not accessing them.

This is my Apache configuration (documentroot.conf):

DocumentRoot /app/www/web

<Directory /app/www/web>
    AllowOverride All
    Options SymlinksIfOwnerMatch
    Order Deny,Allow
    Allow from All
    DirectoryIndex app.php

    FallbackResource /app.php
</Directory>

What is the correct Apache configuration to have Assetic working?

Also, can somebody explain me the difference between the /srv/code, the ~/www (alias of the previous one) and /app/www/web (the folder used in cloudControl examples for Apache config)?

My guess was that the /app/www folder in the apache config was accessing ~/www (and so, accessing /srv/code) but I must be missing something.


Solution

  • In the end, the problem was not in the folder used in the configuration. Both /srv/www/code/web and /app/www/web work the same (as they should, considering that /app/www is an alias of /srv/www/www which is an alias of /srv/www/code, as well explained by @TooAngel).

    The problem was with the assetic:dump command, which for some reason, needs to be called during the build process.

    I've added this to the composer.json file, and now it works:

    {
        ...
        "scripts": {
            "post-install-cmd": [
                "php app/console cache:clear --env=prod",
                "php app/console assets:install --env=prod",
                "php app/console assetic:dump --env=prod"
             ],
             ...
        },
        ...
    }