I didn't have a very solid server side configuration understanding, specifically between source files permission and ownership.
While trying to solve a 403 issue (whenever I access http://symfonyApp.dev/app_dev.php/ ) I misguidedly issued the command:
sudo chmod -R 777 symfonyAppWebRoot
to my web root where my
directories reside...
1.)How would I get the default permission/ownership back to my symfony app files/folders?
2.) or can somebody just explain to me why I get 403 response accessing app_dev.php (on a clean symfony2.6 install after that reckless chmod .. command)?
Fresh symfony2 project access rights:
chmod 775 *
chmod 775 app/ app/config app/console
chmod 664 app/AppCache.php app/AppKernel.php app/autoload.php app/bootstrap.php.cache app/check.php app/phpunit.xml.dist app/SymfonyRequirements.php
chmod 664 app/config/* -R
chmod 777 app/cache app/logs
chmod 775 app/Resources src/ vendor/ web/ -R
chmod 664 app/Resources/base.html.twig
I assume your app_dev.php looks something like this:
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
//... more stuff
Please replace header('HTTP/1.0 403 Forbidden');
with die("It seems like my error has nothing to do with file permissions");
and see what happens. If that doesn't change anything, read on.
"1.)How would I get the default permission/ownership back to my symfony app files/folders?"
You can use chgrp -R www-data symfonyAppWebRoot
instead of chmod -R 777 symfonyAppWebRoot
. As I don't know the original permissions of your files I don't know how to restore those permissions, but It would be something like chmod -R 755 symfonyAppWebROot
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.