NGINX : Not possible to get rights on directories

Discussion in 'Installation/Configuration' started by Jack78, Jan 14, 2014.

  1. Jack78

    Jack78 New Member

    Hi,

    On ubuntu 12.04 LTS server, I've install Nginx (1.1.19 from repository ubuntu) & IspConfig following this standard documentation :
    http://www.howtoforge.com/perfect-server-ubuntu-12.04-lts-nginx-bind-dovecot-ispconfig-3

    Everything seems to work correctly.

    After that, I've create some website with ispconfig.
    Then, I've try to install some software like joomla, for example, in the website directory created by IspConfig :
    /var/www/clients/client1/web1/web/

    It was not possible to do that with the following rights:
    sudo chown -R www-data:www-data /var/www/clients/client1/web4/web/
    sudo find /var/www/clients/client1/web1/web/ -type f -exec chmod 0644 {} \;
    sudo find /var/www/clients/client1/web1/web/ -type d -exec chmod 0755 {} \;

    So, I've try to install with the following ones :
    sudo find /var/www/clients/client1/web1/web/ -type f -exec chmod 0777 {} \;
    sudo find /var/www/clients/client1/web1/web/ -type d -exec chmod 0777 {} \;

    Of course, for security reasons, after installation, I've again done :
    sudo chown -R www-data:www-data /var/www/clients/client1/web4/web/
    sudo find /var/www/clients/client1/web1/web/ -type f -exec chmod 0644 {} \;
    sudo find /var/www/clients/client1/web1/web/ -type d -exec chmod 0755 {} \;

    Joomla is working.

    Yet, when I try to install a component, I've an answer like :

    Warning: Failed to move file!
    JFolder: :files: Path is not a folder. Path: /var/www/clients/client1/web1/web/tmp/install_52d4f0bf0ec9c
    JFolder: :folder: Path is not a folder. Path: /var/www/clients/client1/web1/web/tmp/install_52d4f0bf0ec9c
    JFolder: :files: Path is not a folder. Path: /var/www/clients/client1/web1/web/tmp/install_52d4f0bf0ec9c
    JInstaller: :Install: Cannot find Joomla XML setup file

    So, there is a problem of rights (and my joomla admin panel indicate me that all my directory are unwritable)

    As I've read that Nginx need to have the same rights on the master directory, I've try to apply sudo chown -R www-data:www-data /var/www/

    Yet, my server provide me the following answer :

    chown: changing ownership of `/var/www/clients/client1/web1': Operation not permitted

    Does somebody have an idea ?

    Thanks in advance.

    Brgds
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    the permissions were already correctly set by ispconfig, no need to change them. The permissions that you tried to set would have caused the site to fail as no files in the web dir may be owned by www-data user or group as each site runs under its own user and group in ispconfig. And do not run any chmod commands as this will either make your system insecure ot will it cause to fail, the web directory permissions are already set by ispconfig correctly.

    So the correct settings are:

    1) All sites in the web directory must be owned by the user and group of the website. You see the user and group in the path:

    /var/www/clients/client1/web1/web/

    so in your case, the user is web1 and the group is client1. PHP runs as user web1, so changing the settings to www-data will just cause joomly to fail as the www-data user and group are not the user and group thats php uses.

    If joomla was not able to write files, then the most likelely one of the files or folders in the web directory is not owned by the web user or client group. you can correct it like this:

    chown -R web1:client1 /var/www/clients/client1/web1/web/*
     
  3. Jack78

    Jack78 New Member

    Working. Thanks.

    Hi Till,

    With your answer, it's working perfectly. Thank you very much.

    I should confess I've loose a lot of time ... ;-)

    Brgds
     

Share This Page