(SOLVED) Nginx + PHP-FPM - File Not Found, Primary Script Unknown - Networking, Server, and Protection - Arch Linux Forums
(SOLVED) Nginx + PHP-FPM - File Not Found, Primary Script Unknown - Networking, Server, and Protection - Arch Linux Forums
Arch Linux
Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
Member Hello, I just updated packages and now php-fpm seems not working at all. It gives the errors "File not
From: Trieste, Italy found" in the browser, and "primary script unknown while reading response header" in the log.
Registered: 2018-11-24
I checked all the bhosts, but they are just fine. I suspect there is some change due to the recent
Posts: 89
security issue in php-fpm, but I cannot find a reference to fix the issue. Any idea?
Offline
https://bbs.archlinux.org/viewtopic.php?id=251050 1/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
Inspector Parrot Telling us you looked at the logs is useless, show us. Saying you checked the bhosts is the same.
Show us. Post logs, configs, etc, otherwise there is nothing we can offer here but sympathy (and even
that's not so likely). Is this a publicly available server? Give an example to a failing url.
https://bbs.archlinux.org/viewtopic.php?id=57855
FWIW, I just upgraded my server and have no issues with php-fpm on nginx.
Registered: 2011-11-29
Posts: 29,840 Last edited by Trilby (2019-11-30 14:59:37)
Website
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
2019-11-30 15:27:08 #3
aquilarubra
https://bbs.archlinux.org/viewtopic.php?id=251050 2/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
error.log:
151.95.156.135 - - [30/Nov/2019:16:16:29 +0100] "GET /phpinfo.php HTTP/2.0" 404 36 "-"
"Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0"
vhost:
location ~ \.php$ {
include fastcgi_params;
access_log /home/thelord.space/logs/access_log;
error_log /home/thelord.space/logs/error_log;
fastcgi_param SCRIPT_FILENAME /home/thelord.space/public_html$fastcgi_scrip
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
I tried with the different settings for SCRIPT_FILENAME and none seems working. Previously, the
server was working with the full path: fastcgi_param SCRIPT_FILENAME
/home/thelord.space/public_html$fastcgi_script_name;
The php-fpm error log contains nothing (just the lines when I restart the server).
Obviously, the paths are correct and if I try with user "http", the files are accessible.
Html pages work and Perl works. Only php-fpm seems broken. Php-fpm server runs just fine.
Offline
2019-11-30 16:47:57 #4
Trilby
https://bbs.archlinux.org/viewtopic.php?id=251050 3/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
Inspector Parrot The title of the thread I linked to is "Post complete logs/output/..."
aquilarubra wrote:
Obviously, the paths are correct and if I try with user "http", the files are accessible.
Registered: 2011-11-29 How/why is this obvious? What do you mean you try with user "http"? What do you actually do?
Posts: 29,840 What are (again) the actual commands and output?
Website
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
Offline
Inspector Parrot Three posts in and you have still failed to provide any of the necessary context despite being explicitly
asked twice. I am unable (and now unwilling) to help. I'd encourage you to be much more
transparent and forthcoming if you want the next forum member who sees this thread to put in any
effort to help you.
Registered: 2011-11-29
Posts: 29,840 "UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Website
https://bbs.archlinux.org/viewtopic.php?id=251050 4/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
Online
Member You must be joking, I have answered every question and published my configuration and logs. Get
From: Trieste, Italy glasses.
Registered: 2018-11-24
Posts: 89
Offline
Offline
2019-11-30 17:34:32 #9
aquilarubra
https://bbs.archlinux.org/viewtopic.php?id=251050 5/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
Member Yes. Sorry, I saw I omitted a few lines, as I am doing many tests.
From: Trieste, Italy
Host configuration:
Registered: 2018-11-24
Posts: 89
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
# Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param HTTP_PROXY "";
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
access_log /home/thelord.space/logs/access_log;
error_log /home/thelord.space/logs/error_log;
fastcgi_params file:
https://bbs.archlinux.org/viewtopic.php?id=251050 6/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
Offline
Offline
https://bbs.archlinux.org/viewtopic.php?id=251050 7/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
Member Thanks, that could be the case, as I have a folder outside /home that is partially working. But I edited
From: Trieste, Italy /etc/systemd/system/multi-user.target.wants/php-fpm.service setting ProtectHome=false, reloaded
Registered: 2018-11-24 services, restarted php-fpm, and I still get a 404/file not found error.
Posts: 89
Offline
Offline
Member Question: I use nextcloud, which stores config files in /etc (/etc/webapps/nextcloud). Now it is not
From: Trieste, Italy working (after the update above). It gives the error "Cannot write into "config" directory!", despite the
Registered: 2018-11-24 directory is writeable.
Posts: 89
So, I suspect this depends on the setting ProtectSystem=full in /etc/systemd/system/multi-
user.target.wants/php-fpm.service
Any idea? I cannot find the options that can be used instead of "full".
Offline
Taijian
https://bbs.archlinux.org/viewtopic.php?id=251050 8/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
Offline
Offline
Member
loqs wrote:
Registered: 2016-04-10
Posts: 74 CAP_CHOWN should not be needed with php-fpm 7.4.0-2
Well, for me it complained about not being able to use chown on /run/php-fpm/php-fpm.sock without
that CAP. No idea why it needed to do that, though...
Offline
Offline
https://bbs.archlinux.org/viewtopic.php?id=251050 9/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
Member
loqs wrote:
Registered: 2016-04-10
Posts: 74 @Tainjan that was supposed to be fixed see https://bugs.archlinux.org/task/64683
Offline
Member
aquilarubra wrote:
Registered: 2019-12-18
Posts: 3 Ok, my mistake. It was solved!! Thank you so much.
It did solve my problem for one site. But I'm getting the older error for my another site.
Offline
Offline
https://bbs.archlinux.org/viewtopic.php?id=251050 10/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
file in my system.
Do you know what should I do now?
Offline
Inspector Parrot That has nothing to do with this thread. That "file" is not provided by any package. Read the wiki on
using systemd to enable services.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Registered: 2011-11-29
Posts: 29,840
Website
Online
Offline
ewaller
https://bbs.archlinux.org/viewtopic.php?id=251050 11/12
09/07/2024 20:39 [SOLVED] nginx + php-fpm - file not found, primary script unknown / Networking, Server, and Protection / Arch Linux Forums
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan
Turing
---
From: Pasadena, CA
How to Ask Questions the Smart Way
Registered: 2009-07-13
Posts: 19,986
Offline
Index » Networking, Server, and Protection » [SOLVED] nginx + php-fpm - file not found, primary script unknown
https://bbs.archlinux.org/viewtopic.php?id=251050 12/12