Which permissions should be for symfony 3 folders and files?

后端 未结 1 1582
予麋鹿
予麋鹿 2020-12-22 13:50

I\'ve reinstall Ubuntu 16.04 and after getting pull my symfony 3.4 project from git, it loads but without CSS and JS. I think that the problem with the permissions for folde

相关标签:
1条回答
  • 2020-12-22 14:29

    If it's permissions related, then first make sure of which user is your web user.
    If you never changed it, then it's www-data

    As for the permissions, do this (replace www-data if needed):

    chown -R www-data:www-data /var/www/
    find /var/www/ -type d -exec chmod 0775 "{}" \;
    find /var/www/ -type f -exec chmod 0664 "{}" \;
    find /var/www -type d -exec chmod g+s "{}" \;
    

    [Warning]

    In some projects like symfony, some files have the execution permission.
    Doing this will remove the permission.

    Thus, I recommand to move all your projects out of the /var/www folder before doing this.
    When done with permissions, just copy (not move) your projects in the /var/www folder, they will inherit web user and web group (www-data in this case) and keep execution permission.

    [Side note]

    You're using too many tags.
    file-permissions, symfony, ubuntu should have been enough... ;)

    0 讨论(0)
提交回复
热议问题