Nginx uses www-data in client websites

Discussion in 'Installation/Configuration' started by dfumagalli, Sep 12, 2015.

  1. dfumagalli

    dfumagalli New Member

    Hello,

    I have a kind of weird issue on a ISPConfig 3 + Nginx on Ubuntu 14.04 LTS 64 bit "Perfect Server" setup.
    Everything works awesome except creating files in client websites.

    If I create a new client it gets assigned its proper user and group and rights. However, if I install Wordpress on the resulting client website, the first update it does to iteself or any plugin, it goes in error. If I chmod the directories to 775 or so, Wordpress (or any CMS for that matter) will immediately start to work.... except every file created in the clients directories is user www-data and group www-data.

    It's like PHP-fpm is not switching pools or something. Of course I have rebooted several times to see if there were any hanging processes and similar.
    Here are some things I have checked, based on past replies I have Googled about other similar issues involving ISPConfig 3 and Nginx:

    Here's a directory listing:
    Code:
     ls -l
    total 208
    drwxrwxr-x  4 www-data www-data 4096 Jul 18 21:47 akismet
    drwxr-xr-x  4 web2     client2  4096 Feb  9  2015 better-delete-revision
    drwxr-xr-x  2 web2     client2  4096 Feb  9  2015 blog-comments-seo
    drwxrwxr-x 10 www-data www-data 4096 Jul  5 11:06 broken-link-checker
    drwxrwxr-x  2 web2     client2  4096 Apr 11 09:58 cloudflare
    drwxrwxr-x  7 www-data www-data 4096 Aug  4 16:30 contact-form-7
    drwxrwxr-x  6 www-data www-data 4096 Sep 12 06:45 contextual-related-posts
    drwxrwxr-x  6 web2     client2  4096 Mar  5  2015 delete-expired-transients
    drwxrwxr-x  6 www-data www-data 4096 Aug 26 10:15 easy-digital-downloads
    ...
    
    You see some entries are owned by web2:client2 but that's only because I had manually chowned them back to the original, otherwise I'd only get www-data entries.

    Here's an excerpt from the /etc/group file:

    Code:
    sshusers:x:5002:web2
    ispapps:x:5003:www-data
    ispconfig:x:5004:www-data
    memcache:x:122:
    client1:x:5005:www-data
    varnish:x:123:
    varnishlog:x:124:
    opendkim:x:125:
    client2:x:5006:www-data
    I have checked if there's a web2 PHP-fpm configuration entry:

    Code:
    ls -l /etc/php5/fpm/pool.d/
    total 32
    -rw-r--r-- 1 root root   372 Feb  6  2015 apps.conf
    -rw-r--r-- 1 root root   466 Feb  6  2015 ispconfig.conf
    -rw-r--r-- 1 root root   904 Mar  4  2015 web2.conf
    -rw-r--r-- 1 root root 17401 Jul  7  2014 www.conf
    It contains this:

    Code:
    [web2]
    
    listen = /var/lib/php5-fpm/web2.sock
    listen.owner = web2
    listen.group = client2
    listen.mode = 0660
    
    user = web2
    group = client2
    
    pm = dynamic
    pm.max_children = 10
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 5
    pm.max_requests = 0
    
    chdir = /
    
    php_admin_value[open_basedir] = /var/www/clients/client2/web2/web:/var/www/clients/client2/web2/private:/var/www/clients/client2/web2/tmp:/var/www/pugno-in-faccia-opinioni-notizie-economia-finanza.it/web:/srv/www/pugno-in-faccia-opinioni-notizie-economia-finanza.it/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/php/etc/php5/fpm/pool.d/web2.conf
    
    I have checked for the appropriate PHP-fpm pool lock file:

    Code:
     ls -l /var/lib/php5-fpm/web2.sock
    srw-rw---- 1 web2 client2 0 Aug 26 10:37 /var/lib/php5-fpm/web2.sock
    I have checked the running pools:

    Code:
     ps aux | grep pool
    ispapps   1254  0.0  0.0 501060   292 ?        S    Aug26   0:00 php-fpm: pool apps
    ispapps   1256  0.0  0.0 501060   292 ?        S    Aug26   0:00 php-fpm: pool apps
    web2      1257  0.0  0.0 499100   292 ?        S    Aug26   0:00 php-fpm: pool web2
    web2      1258  0.0  0.0 499100   292 ?        S    Aug26   0:00 php-fpm: pool web2
    ispconf+  1259  0.0  0.0 501060   292 ?        S    Aug26   0:00 php-fpm: pool ispconfig
    ispconf+  1260  0.0  0.0 501060   292 ?        S    Aug26   0:00 php-fpm: pool ispconfig
    www-data 30493  0.6  7.2 520384 74188 ?        S    06:45   0:18 php-fpm: pool www
    www-data 30495  1.1  8.0 525636 82056 ?        S    06:45   0:33 php-fpm: pool www
    www-data 30714  0.8  7.3 520296 74836 ?        S    06:49   0:20 php-fpm: pool www
    root     31748  0.0  0.0  11744   916 pts/0    R+   07:33   0:00 grep --color=auto pool
    It looks all in order. However even this morning, I could not update a web2 website Wordpress plugin. It's directory was set as web2:client2 and Wordpress reported access denied errors until I manually changed that directory to www-data:www-data. After that, it updated fine.

    Thanks in advance for any tip or help you'll provide.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    did you add anything in the nginx firectives field of the website?
     
  3. dfumagalli

    dfumagalli New Member

    No, neither in Nginx directives nor in PHP directives.
    I have put SSL keys as perhaps the only customization I've done in there.
     

Share This Page