• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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