i-MSCP - PHP-FPM - Umask

  • Hello ;


    For those that are using the i-MSCP apache php-fpm server implementation, you can end with a little problem when using some Web applications such as Wordpress, which is creating its own .htaccess file in some contexts (eg, when changing permalink settings).


    In the case of Wordpress you will get a 403 error after changing permalink settings. This is due to the fact that the .htaccess file (located at root of the documentRoot - eg htdocs) is created with umask 027 (0640) and so, the www-data user (Apache user) cannot access to it.


    To fix the problem, you have two solutions:


    The first is to simply change permissions of the .htaccess file to 0644 instead of 0640.


    The other solution is to change the template file located at /etc/imscp/php-fpm/parts/pool.conf as follow:


    Code
    1. listen.owner = {USER}listen.group = {APACHE_GROUP}listen.mode = 0660


    to


    Code
    1. listen.owner = {USER}
    2. listen.group = {GROUP}
    3. listen.mode = 0666


    That will change the umask to 022 for PHP, allowing to create any file as 0644 instead of 0640.


    After editing that file, you must run the /var/www/imscp/engine/imscp-setup script to force regeneration of production files.


    Of course, this change only apply for newly created files. You must fix manually for any existent file that was created with permissions 0640.


    In the next coming release, the umask for all i-MSCP Httpd and Ftpd server implementations will be set to 027 (0750 for newly created directories, 0640 for newly created files). This will not be a problem because the Apache user (www-data) will be part of the vuxxx group and so, it will be able to traverse directories and read needed files.


    Thanks to gOOvER for reporting me this problem.


    Thank you for using i-MSCP

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

    Edited once, last by Nuxwin ().