這是我的地盤 - 可用/ myServer上,正確鏈接到網站啓用/ myServer上:PHP7 FPM和Nginx的 - 獲得404
server {
listen 80;
server_name sub.domain.net;
location/{
root /home/tyrion/saveup-compute;
index index.php index.html index.htm
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/username/myServer/$fastcgi_script_name;
include fastcgi_params;
}
}
我去到PHP FPM文件,並設置660和www數據和設置在我的目錄中輸入www-data:myuser。不過,我不能提供一個單一的PHP文件。 (HTML工作得很好)。
Nginx的訪問日誌:
MYIP - - [15/Sep/2016:23:09:13 +0000] "GET /info.php HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
Nginx的錯誤日誌:
2016/09/15 23:09:13 [error] 38415#38415: *2 open() "/home/myUser/myServer/404.html" failed (2: No such file or directory), client: 62.155.132.7, server: sub.somain.net, request: "GET /info.php HTTP/1.1", host: "sub.somain.net"
php7.0-fpm.log:
[15-Sep-2016 21:54:49] NOTICE: fpm is running, pid 35917
[15-Sep-2016 21:54:49] NOTICE: ready to handle connections
[15-Sep-2016 21:54:49] NOTICE: systemd monitor interval set to 10000ms
[15-Sep-2016 22:56:58] NOTICE: Terminating ...
[15-Sep-2016 22:56:58] NOTICE: exiting, bye-bye!
[15-Sep-2016 22:56:58] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful
[15-Sep-2016 22:56:58] NOTICE: fpm is running, pid 37925
[15-Sep-2016 22:56:58] NOTICE: ready to handle connections
[15-Sep-2016 22:56:58] NOTICE: systemd monitor interval set to 10000ms
你應該嘗試'try_files $ uri $ uri//index.php?$ args;'或者這些行 – Perspective
你確定你的文件位於'/ home/tyrion/saveup-compute'嗎?你在使用任何類型的'mod_rewrite'路由嗎? – Blake
沒有mod_rewrite,但也許我應該考慮它。 – nottinhill