• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Issue NGinx permissions denied when download files from PHP

Alexdb

New Pleskian
i have a Plesk: psa v12.5.30_build1205150826.19 os_Ubuntu 14.04

recently i made a big mistake and ran this command: chown -R 10003:1003 /
It set all my permissions to 10003 and myPlesk was broken. I repair it via ssh with plesk repair fs and launched an update of plesk via ssh.

But i have still some issue, when i triggers a download via PHP with this code:
$mm_type="application/octet-stream";
$file = '../uploads/files/' . $filename;
header("Cache-Control: public, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: " . $mm_type);
header("Content-Length: " .filesize($filename));
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");

ob_end_clean();

readfile($file);

my files are the size of 64kb so they should be 17MB. I investigated and found this error in "proxy_error_log':
2019/01/20 18:34:53 [crit] 28055#0: *17137 open() "/var/lib/nginx/proxy/3/10/0000000103" failed (13: Permission denied) while reading upstream, client: 80.XXX.XXX.XXX, server: mydomain.com, request: "GET /download.php?id=15 HTTP/1.1", upstream: "https://45.XXX.XXX.XXX:7081/download.php?id=15", host: "mydomain.com"

This permissions issue reapper, can you tell me whats the good permissions for /var/lib/nginx please? Or tell my how to set the rights permissions.
Thanks
 
drwx------ 7 nginx nginx 4096 Dec 4 13:40 nginx

./nginx:
drwx------ 7 nginx nginx 4096 Dec 4 13:40 .
drwxr-xr-x. 39 root root 4096 Dec 3 18:34 ..
drwx------ 2 nginx root 4096 Jan 20 20:31 body
drwx------ 9 nginx root 4096 Jan 4 16:57 fastcgi
drwx------ 12 nginx root 4096 Dec 7 13:54 proxy
drwx------ 2 nginx root 4096 Dec 2 15:07 scgi
drwx------ 2 nginx root 4096 Dec 2 15:07 uwsgi
 
thanks, that's what i have. But can you show me what you have in body and proxy please?

I think i solved my issue by ran this in body and proxy:
chown -R nginx:root *
because in body and proxy permissions were set to: root:root
 
Back
Top