Get the most out of your Centmin Mod LEMP stack
Become a Member

Wordpress Folders can't take permission

Discussion in 'Blogs & CMS usage' started by gamal, Apr 3, 2018.

  1. gamal

    gamal Member

    40
    3
    8
    Jan 31, 2018
    Ratings:
    +3
    Local Time:
    5:40 PM
    1.13.8
    • CentOS Version: CentOS Linux 7.4.1708
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: nginx/1.13.10

    ok this is the first time to experience this scenario, I have installed multiple WordPress websites before same way and it was working smooth. here are my steps.

    1. installed centminmod on digitalocean droplet.
    2. created nginx vhost using the option 2 from the menu
    3. uploaded files and imported MySQL db.
    4. 502 Bad Gateway

    after some investigation, I realized that most of the folders don't have the right permissions, no matter what commands I give its not changing, always 000.

    also in winscp the owner appears as (1001), while on my other successful website setups it appears as nginx
     
  2. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,150
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,546
    Local Time:
    5:40 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    how are you loading files ? via root user in sftp or via generated pure-ftpd virtual user ?

    see getting started guide step 2 if you're using root user via sftp
     
  3. gamal

    gamal Member

    40
    3
    8
    Jan 31, 2018
    Ratings:
    +3
    Local Time:
    5:40 PM
    1.13.8
    via generated pure-ftpd virtual user
     
  4. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,150
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,546
    Local Time:
    5:40 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    What are you permissions for

    /home/nginx/domains directory
    Code (Text):
    ls -lah /home/nginx/domains/
    total 4.0K
    drwxr-s---. 8 nginx nginx 4.0K Apr  2 16:21 .
    drwx--S---. 3 nginx nginx   73 Sep 25  2017 ..
    drwxr-x---. 6 nginx nginx   56 Sep 25  2017 demodomain.com
    drwxr-s---  6 nginx nginx   56 Apr  2 16:20 domain1.com
    drwxr-s---  6 nginx nginx   56 Apr  2 16:20 domain2.com
    drwxr-s---  6 nginx nginx   56 Apr  2 16:21 http2.domain1.com
    drwxr-s---  6 nginx nginx   56 Apr  2 16:20 sub1.domain1.com
    drwxr-s---  6 nginx nginx   56 Apr  2 16:20 sub2.domain2.com
    

    and /home/nginx/domains/yourdomain.com ?
    Code (Text):
    ls -lah /home/nginx/domains/domain1.com/
    total 8.0K
    drwxr-s---  6 nginx nginx   56 Apr  2 16:20 .
    drwxr-s---. 8 nginx nginx 4.0K Apr  2 16:21 ..
    drwxr-s---  2 nginx nginx    6 Apr  2 16:20 backup
    drwxr-s---  2 nginx nginx   90 Apr  3 05:13 log
    drwxr-s---  2 nginx nginx    6 Apr  2 16:20 private
    drwxr-s---  2 nginx nginx 4.0K Apr  2 16:20 public
    

    and /home/nginx/domains/yourdomain.com/public ?
    Code (Text):
    ls -lah /home/nginx/domains/domain1.com/public/
    total 56K
    drwxr-s--- 2 nginx nginx 4.0K Apr  2 16:20 .
    drwxr-s--- 6 nginx nginx   56 Apr  2 16:20 ..
    -rw-r----- 1 nginx nginx 2.0K Apr  2 16:20 401.html
    -rw-r----- 1 nginx nginx 2.0K Apr  2 16:20 403.html
    -rw-r----- 1 nginx nginx 1.9K Apr  2 16:20 404.html
    -rw-r----- 1 nginx nginx 2.0K Apr  2 16:20 500.html
    -rw-r----- 1 nginx nginx 2.0K Apr  2 16:20 502.html
    -rw-r----- 1 nginx nginx 2.0K Apr  2 16:20 503.html
    -rw-r----- 1 nginx nginx 7.6K Apr  2 16:20 503.jpg
    -rw-r----- 1 nginx nginx 2.0K Apr  2 16:20 504.html
    -rw-r----- 1 nginx nginx 2.0K Apr  2 16:20 50x.html
    -rw-r----- 1 nginx nginx 5.9K Apr  2 16:20 index.html
    -rw-r----- 1 nginx nginx 2.1K Apr  2 16:20 maintenance.html
    

    and for command pure-pw show ftp1 where ftp1 is your pure-ftpd virtual ftp username
    Code (Text):
    pure-pw show ftp1
    
    Login              : ftp1
    Password           : $6$bbZgAWZBmyXA.MI0$0DwMqNPapCZodAUbqHSLtR18YcdFBX.Hx/sQTkjrZpbWkPbPWh6KCJH3eYVzMKfWEmpk112wLmqKmBeID9U.D/
    UID                : 1000 (nginx)
    GID                : 1000 (nginx)
    Directory          : /home/nginx/domains/domain1.com/./
    Full name          : 
    Download bandwidth : 0 Kb (unlimited)
    Upload   bandwidth : 0 Kb (unlimited)
    Max files          : 0 (unlimited)
    Max size           : 0 Mb (unlimited)
    Ratio              : 0:0 (unlimited:unlimited)
    Allowed local  IPs : 
    Denied  local  IPs : 
    Allowed client IPs : 
    Denied  client IPs : 
    Time restrictions  : 0000-0000 (unlimited)
    Max sim sessions   : 0 (unlimited)
    
     
  5. gamal

    gamal Member

    40
    3
    8
    Jan 31, 2018
    Ratings:
    +3
    Local Time:
    5:40 PM
    1.13.8
    Code:
    total 0
    drwxr-s---. 4 nginx nginx  46 Apr  2 16:25 .
    drwx--S---. 3 nginx nginx 108 Apr  2 15:23 ..
    drwxr-x---. 6 nginx nginx  60 Apr  2 15:23 demodomain.com
    drwxr-s---. 6 nginx nginx  60 Apr  2 16:25 usa2eg.com
    [11:24][[email protected] ~]# ls -lah /home/nginx/domains/
    total 0
    drwxr-s---. 4 nginx nginx  46 Apr  2 16:25 .
    drwx--S---. 3 nginx nginx 108 Apr  2 15:23 ..
    drwxr-x---. 6 nginx nginx  60 Apr  2 15:23 demodomain.com
    drwxr-s---. 6 nginx nginx  60 Apr  2 16:25 usa2eg.com
    
    
    Code:
    [11:13][[email protected] ~]# ls -lah /home/nginx/domains/
    total 0
    drwxr-s---. 4 nginx nginx  46 Apr  2 16:25 .
    drwx--S---. 3 nginx nginx 108 Apr  2 15:23 ..
    drwxr-x---. 6 nginx nginx  60 Apr  2 15:23 demodomain.com
    drwxr-s---. 6 nginx nginx  60 Apr  2 16:25 usa2eg.com
    [11:13][[email protected] ~]# ^C
    [11:13][[email protected] ~]# ls -lah /home/nginx/domains/usa2eg.com/
    total 4.0K
    drwxr-s---. 6 nginx nginx   60 Apr  2 16:25 .
    drwxr-s---. 4 nginx nginx   46 Apr  2 16:25 ..
    drwxr-s---. 2 nginx nginx    6 Apr  2 16:25 backup
    drwxr-s---. 2 nginx nginx   41 Apr  2 16:26 log
    drwxr-s---. 2 nginx nginx    6 Apr  2 16:25 private
    drwxr-xr-x. 5 nginx nginx 4.0K Apr  3 08:41 public
    

    Code:
    [11:16][[email protected] ~]# ls -lah /home/nginx/domains/usa2eg.com/public/
    total 4.2M
    drwxr-xr-x.  5 nginx nginx 4.0K Apr  3 08:41 .
    drwxr-s---.  6 nginx nginx   60 Apr  2 16:25 ..
    -rw-r--r--.  1 nginx nginx 4.0M Apr  2 18:42 artolo5_USA2EG.sql
    -rw-r--r--.  1 nginx nginx  418 Apr  2 18:43 index.php
    -rw-r--r--.  1 nginx nginx  20K Apr  2 18:43 license.txt
    -rw-r--r--.  1 nginx nginx 7.3K Apr  2 18:43 readme.html
    -rw-r--r--.  1 nginx nginx 5.4K Apr  2 18:43 wp-activate.php
    drwxrwxr-x. 10 nginx nginx 4.0K Apr  2 18:56 wp-admin
    -rw-r--r--.  1 nginx nginx  364 Apr  2 18:43 wp-blog-header.php
    -rw-r--r--.  1 nginx nginx 1.6K Apr  2 18:43 wp-comments-post.php
    -rw-r--r--.  1 nginx nginx 3.0K Apr  3 08:13 wp-config.php
    -rw-r--r--.  1 nginx nginx 2.7K Apr  2 18:43 wp-config-sample.php
    drwxrwxr-x.  7 nginx nginx  112 Apr  2 19:00 wp-content
    -rw-r--r--.  1 nginx nginx 3.6K Apr  2 18:43 wp-cron.php
    drwxrwxr-x. 18 nginx nginx 8.0K Apr  3 00:03 wp-includes
    -rw-r--r--.  1 nginx nginx 2.4K Apr  2 18:43 wp-links-opml.php
    -rw-r--r--.  1 nginx nginx 3.3K Apr  2 18:43 wp-load.php
    -rw-r--r--.  1 nginx nginx  36K Apr  2 18:43 wp-login.php
    -rw-r--r--.  1 nginx nginx 7.9K Apr  2 18:43 wp-mail.php
    -rw-r--r--.  1 nginx nginx  16K Apr  2 18:43 wp-settings.php
    -rw-r--r--.  1 nginx nginx  30K Apr  2 18:43 wp-signup.php
    -rw-r--r--.  1 nginx nginx 4.6K Apr  2 18:43 wp-trackback.php
    -rw-r--r--.  1 nginx nginx 3.0K Apr  2 18:43 xmlrpc.php
    [11:17][[email protected] ~]# [11:16][[email protected] ~]# ls -lah /home/nginx/domains/usa2eg.com/public/
    total 4.2M
    drwxr-xr-x.  5 nginx nginx 4.0K Apr  3 08:41 .
    drwxr-s---.  6 nginx nginx   60 Apr  2 16:25 ..
    -rw-r--r--.  1 nginx nginx 4.0M Apr  2 18:42 artolo5_USA2EG.sql
    -rw-r--r--.  1 nginx nginx  418 Apr  2 18:43 index.php
    -rw-r--r--.  1 nginx nginx  20K Apr  2 18:43 license.txt
    -bash: [11:16][[email protected]: command not found
    [11:17][[email protected] ~]# total 4.2M
    -rw-r--r--.  1 nginx nginx 7.3K Apr  2 18:43 readme.html
    -rw-r--r--.  1 nginx nginx 5.4K Apr  2 18:43 wp-activate.php
    drwxrwxr-x. 10 nginx nginx 4.0K Apr  2 18:56 wp-admin
    -rw-r--r--.  1 nginx nginx  364 Apr  2 18:43 wp-blog-header.php
    -rw-r--r--.  1 nginx nginx 1.6K Apr  -bash: total: command not found
    [11:17][[email protected] ~]# drwxr-xr-x.  5 nginx nginx 4.0K Apr  3 08:41 .
    -bash: drwxr-xr-x.: command not found
    [11:17][[email protected] ~]# drwxr-s---.  6 nginx nginx   60 Apr  2 16:25 ..
    -bash: drwxr-s---.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 4.0M Apr  2 18:42 artolo5_USA2EG.sql
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx  418 Apr  2 18:43 index.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx  20K Apr  2 18:43 license.txt
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 7.3K Apr  2 18:43 readme.html
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 5.4K Apr  2 18:43 wp-activate.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# drwxrwxr-x. 10 nginx nginx 4.0K Apr  2 18:56 wp-admin
    -bash: drwxrwxr-x.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx  364 Apr  2 18:43 wp-blog-header.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 1.6K Apr  [11:16][[email protected] ~]# ls -lah /home/nginx/domains/usa2eg.com/public/
    total 4.2M
    drwxr-xr-x.  5 nginx nginx 4.0K Apr  3 08:41 .
    drwxr-s---.  6 nginx nginx   60 Apr  2 16:25 ..
    -rw-r--r--.  1 nginx nginx 4.0M Apr  2 18:42 artolo5_USA2EG.sql
    -rw-r--r--.  1 nginx nginx  418 Apr  2 18:43 index.php
    -rw-r--r--.  1 nginx nginx  20K Apr  2 18:43 license.txt
    -rw-r--r--.  1 nginx nginx 7.3K Apr  2 18:43 readme.html
    -rw-r--r--.  1 nginx nginx 5.4K Apr  2 18:43 wp-activate.php
    drwxrwxr-x. 10 nginx nginx 4.0K Apr  2 18:56 wp-admin
    -rw-r--r--.  1 nginx nginx  364 Apr  2 18:43 wp-blog-header.php
    -rw-r--r--.  1 nginx nginx 1.6K Apr  2 18:43 wp-comments-post.php
    -rw-r--r--.  1 nginx nginx 3.0K Apr  3 08:13 wp-config.php
    -rw-r--r--.  1 nginx nginx 2.7K Ap-bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# total 4.2M
    -bash: total: command not found
    [11:17][[email protected] ~]# drwxr-xr-x.  5 nginx nginx 4.0K Apr  3 08:41 .
    -bash: drwxr-xr-x.: command not found
    [11:17][[email protected] ~]# drwxr-s---.  6 nginx nginx   60 Apr  2 16:25 ..
    -bash: drwxr-s---.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 4.0M Apr  2 18:42 artolo5_USA2EG.sql
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx  418 Apr  2 18:43 index.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx  20K Apr  2 18:43 license.txt
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 7.3K Apr  2 18:43 readme.html
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 5.4K Apr  2 18:43 wp-activate.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# drwxrwxr-x. 10 nginx nginx 4.0K Apr  2 18:56 wp-admin
    -bash: drwxrwxr-x.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx  364 Apr  2 18:43 wp-blog-header.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 1.6K Apr  2 18:43 wp-comments-post.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 3.0K Apr  3 08:13 wp-config.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 2.7K Apound
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# [11:17][[email protected] ~]# -rw-r--r--[11:16][[email protected] ~]# ls -lah /home/nginx/domains/usa2eg.com/public/
    total 4.2M
    drwxr-xr-x.  5 nginx nginx 4.0K Apr  3 08:41 .
    drwxr-s---.  6 nginx nginx   60 Apr  2 16:25 ..
    -rw-r--r--.  1 nginx nginx 4.0M Apr  2 18:42 artolo5_USA2EG.sql
    -rw-r--r--.  1 nginx nginx  418 Apr  2 18:43 index.php
    -rw-r--r--.  1 nginx nginx  20K Apr  2 18:43 license.txt
    -rw-r--r--.  1 nginx nginx 7.3K Apr  2 18:43 readme.html
    -rw-r--r--.  1 nginx nginx 5.4K Apr  2 18:43 wp-activate.php
    drwxrwxr-x. 10 nginx nginx 4.0K Apr  2 18:56 wp-admin
    -rw-r--r--.  1 nginx nginx  364 Apr  2 18:43 wp-blog-header.php
    -rw-r--r--.  1 nginx nginx 1.6K Apr-bash: [11:17][[email protected]: command not found
    [11:17][[email protected] ~]# total 4.2M
    -bash: total: command not found
    [11:17][[email protected] ~]# drwxr-xr-x.  5 nginx nginx 4.0K Apr  3 08:41 .
    -bash: drwxr-xr-x.: command not found
    [11:17][[email protected] ~]# drwxr-s---.  6 nginx nginx   60 Apr  2 16:25 ..
    -bash: drwxr-s---.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 4.0M Apr  2 18:42 artolo5_USA2EG.sql
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx  418 Apr  2 18:43 index.php
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx  20K Apr  2 18:43 license.txt
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 7.3K Apr  2 18:43 readme.html
    -bash: -rw-r--r--.: command not found
    [11:17][[email protected] ~]# -rw-r--r--.  1 nginx nginx 5.4K Apr  2 18:43 wp-activate.php
    
    Code:
     pure-pw show ftp1
    Unable to fetch info about user [ftp1] in file [/etc/pure-ftpd/pureftpd.passwd]
     
    Last edited: Apr 3, 2018
  6. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,150
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,546
    Local Time:
    5:40 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    permissions look fine from your output

    replace ftp1 with your pure-ftpd username
     
  7. gamal

    gamal Member

    40
    3
    8
    Jan 31, 2018
    Ratings:
    +3
    Local Time:
    5:40 PM
    1.13.8
    Code:
    [11:25][[email protected] ~]# pure-pw show ******
    
    Login              : ****
    Password           : *******
    UID                : 1001 (nginx)
    GID                : 1001 (nginx)
    Directory          : /home/nginx/domains/usa2eg.com/./
    Full name          :
    Download bandwidth : 0 Kb (unlimited)
    Upload   bandwidth : 0 Kb (unlimited)
    Max files          : 0 (unlimited)
    Max size           : 0 Mb (unlimited)
    Ratio              : 0:0 (unlimited:unlimited)
    Allowed local  IPs :
    Denied  local  IPs :
    Allowed client IPs :
    Denied  client IPs :
    Time restrictions  : 0000-0000 (unlimited)
    Max sim sessions   : 0 (unlimited
     
    Last edited: Apr 3, 2018
  8. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,150
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,546
    Local Time:
    5:40 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    looks correct pure-ftpd UID/GID = nginx userid = 1001

    filezilla reports user/group as numeric id it seems but it's system nginx user = 1001

    on my system and can be different for your server i.e. I have nginx = 1000
    Code (Text):
    id nginx
    uid=1000(nginx) gid=1000(nginx) groups=1000(nginx)
    


    upload_2018-4-3_21-34-12.png
     
  9. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,150
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,546
    Local Time:
    5:40 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  10. gamal

    gamal Member

    40
    3
    8
    Jan 31, 2018
    Ratings:
    +3
    Local Time:
    5:40 PM
    1.13.8
    but the inner folders don't have permissions and no matter chmod commands i give nothing change !!!
     

    Attached Files:

  11. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,150
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,546
    Local Time:
    5:40 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    not able to replicate that on my end using filezilla - uploading files as pure-ftpd user give me correct permissions

    have you tried another ftp client i.e. filezilla ?

    or just do a chown fix as root user in SSH run
    Code (Text):
    chown -R nginx:nginx /home/nginx/domains/usa2eg.com/public
    


    You can also confirm if the issue is server itself, create a dummy nginx vhost via centmin.sh menu option 2 and confirm if that pure-ftpd user's uploaded files/dirs have same issue
     
  12. gamal

    gamal Member

    40
    3
    8
    Jan 31, 2018
    Ratings:
    +3
    Local Time:
    5:40 PM
    1.13.8
    i have totally destroyed the old droplet, created new one and do installation from scratch, the problem is still there
     
  13. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,150
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,546
    Local Time:
    5:40 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    • All above output you posted in post #5 and #7 show correct nginx user and group and file permissions so what you're seeing might be FTP client specific in winscp ? did you try filezilla or another FTP client ?
    • Do you have any wordpress plugins on this wordpress instance, not present in other wordpress installs ?
    • Any wordpress plugins that are security related which may change the installs user permissions ?

    So file and directory permissions and user/group are correct according to your output. What is the problem the 502 errors that result ? 502 isn't file permission errors it's means Nginx can't connect to PHP-FPM because PHP-FPM is either busy or crashed or PHP-FPM in turn is waiting on slow MySQL server to response with data due to a long running MySQL query. So you need to tune PHP-FPM and maybe look at MySQL slow queries.

    If on wordpress having full page caching helps i.e. centmin.sh memu option 22, keycdn cache enabler helps because it offloads load from PHP-FPM and MySQL to Nginx.
     
  14. gamal

    gamal Member

    40
    3
    8
    Jan 31, 2018
    Ratings:
    +3
    Local Time:
    5:40 PM
    1.13.8
    ok now i solved the file and folder permissions through filezilla, the error now is as follows:

    This site can’t provide a secure connection
    www.usa2eg.com doesn't adhere to security standards.

    ERR_SSL_SERVER_CERT_BAD_FORMAT

    i make the SSL options just like i do everytime from menu option 2, what could be wrong?
     
  15. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,150
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,546
    Local Time:
    5:40 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    I'd start a thread in Domains, DNS, Email & SSL Certificates
     
..