John the Ripper John the Ripper - 2 months ago 16
Apache Configuration Question

Symfony Apache and Deployer - modify assets location from under Symfony Web directory to another filesystem location

Symfony 2.8

Apache 2.4

Deployer 3.3

Apache user: www-data

Currently the assets directory where images get uploaded is under the Symfony web directory:


When I deploy new versions using Deployer I have to move all of the images into the new assets directory. Although not a big task at the moment (there are 16,000+ images), as we grow this will likely cause issues. Furthermore since the
directory in the path is a symbolic link, it seems that apache/php keeps the old location in memory and serves data from it meaning that requests for those images generate 404 errors.

Moving this directory to another location (and even another hard drive) would solve these annoyances. I don't feel that I have the experience to do this safely without first consulting some best practices. I'm sure I could figure out how to add an
in the apache configuration, but I'm concerned about security and how things will operate with Symfony.

My question then is where should the assets directory go in the filesystem with what permissions and what Apache configuration should be applied so that Symfony will not be affected negatively?



You can add your assets directory to "shared_dirs" variable, which is used to keep your shared/common files and directories between releases. In this case your assets directory will be stored in /var/www/html/project/shared folder and symlinked to each release.

set('shared_dirs', [

As for Apache symlink issue, please try to reload Apache server's configuration within deployment process.

// Reload Apache configuration to avoid symlink issue
task('apache:reload', function () {
    run('sudo /etc/init.d/apache2 reload');
})->desc('Reload Apache configuration');
after('cleanup', 'apache:reload');