Linux deployment Symfoy2 permissions settings for App/cache and app/logs directories, symfoy2logs
After deploying the Symfony2 under Linux, it is possible to report app/logs or App/cache directories without write permission when accessing the directory. Under Linux, if the user we landed at the command line is different from the user of the Web application server (Apache, Nginx, etc.),
You can use the following four methods to solve this problem.
1. Use ACLs on systems that support chmod +a
Many versions of the Linux system support chmod +a commands, so we prefer to use this command. Find the user name assignment on the Web application server to the variable httpduser.
1 $ rm-rf app/cache/* 2 $ rm-rf app/logs/* 3 4 $ httpduser= ' ps aux | Grep-e '[a]pache| [H]ttpd| [_]www| [w]ww-data| [n]Ginx ' | Grep-v Root | Head-1 | cut-d\ -f1 '5 $ sudo chmod +a "$HTTPDUSER allow Delete,write,append,file_inherit,dir Ectory_inherit " app/cache app/logs6 $ sudo chmod +a" ' WhoAmI ' Allow Delete,write,append,file_ Inherit,directory_inherit "App/cache app/logs
The four-line command is to find out the user name of the Web application server assigned to the variable Httpduser, and the five-line command is to give the Web application server permission to read, write, and create directories for app/logs or app/cache directories; the command line login user to app/ Logs or App/cache directory read, write, create directories and other permissions.
2, if the system does not support chmod +a, then use the SETFACL command to set the ACL
The first thing to determine is that the directory is located in a partition that supports ACLs and installed SETFACL commands.
1 $ httpduser= ' ps aux | Grep-e '[a]pache| [H]ttpd| [_]www| [w]ww-data| [n]Ginx ' | Grep-v Root | Head-1 | cut-d\ -f1 '2 $ sudo setfacl-r-M u: "$HTTPDUSER": rwx-m u: ' whoami ': RwX App/cach E app/logs3 $ sudo setfacl-dr-m u: "$HTTPDUSER": rwx-m u: ' whoami ': RwX app/cache app/logs
If this does not work, add the-N option to the second to third line command.
3. Do not use ACLs
If you do not use ACLs, you can also change the umask so that the user groups for both directories have permission to create and modify files (775, and the Web application Server and command line users are in the same group) or all users have permission to create and modify files (777), but both sets of permissions are unsafe. The permissions given are too high. Add the following code to app/console
, web/app.php
and web/app_dev.php
the first line of the file.
1 umask (0002// generated directories (App/cache and App/logs) permissions are 077523 or 45 umask (0000// generated directory (App/cache and app/ Logs) permission is 0777
Note: PHP's umask command is non-thread safe.
4. The user of the command line login and the user of the Web application server are the same user.
How to configure the XML file in Tomcat
Beginner's words will be configured with a port number and user rights can be ~ Other No tube
http://www.bkjia.com/PHPjc/894760.html www.bkjia.com true http://www.bkjia.com/PHPjc/894760.html techarticle Linux deployment Symfoy2 to App/cache and app/logs directory permissions settings, Symfoy2logs deployed under Linux Symfony2, may be reported in the visit app/logs or app/ The cache directory does not have write rights ...