百度了半天找到別人的解決辦法 記錄下
摘要: file not found. nginx php 這個問題是你配置文件的問題: 查看就是了不要管 nginx 如何開啟解析 PHP 的功能? # 成功安裝后,創建 php-fpm.conf 配置文件,刪除 nginx.conf 中“pass the PHP scripts to FastCGI
file not found. nginx php
這個問題是你配置文件的問題:
查看就是了不要管
nginx 如何開啟解析 PHP 的功能?
# 成功安裝后,創建 php-fpm.conf 配置文件,刪除 nginx.conf 中“pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000”部分的注釋
cd /usr/local/php/etc
mv php-fpm.conf.default php-fpm.conf
vi /usr/local/nginx/conf/nginx.conf
# 刪除如下部分的注釋,保存退出,
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
解決辦法:
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
這一句有問題,請再仔細查想一下為什么?
- 華晨@kut : 發現了更好的辦法,/scripts 改成 $document_root 就好了,呵呵。 (
- 華晨@kut : 哦,我知道了,把 /scripts 改成 /usr/local/nginx/html 就可以了。我剛才在服務器上試了一下,真的可以找到文件並且成功解析了!十分感謝! (4年前)
- kut@華晨: /scripts是一個目錄名,也就是你站點的根目錄,比如說,你訪問/index.php這個文件,其實就是訪問操作系統中/scripts/index.php這個文件,這個文件是否存在?(4年前)
-
# 啟動 php-fpm 和 nginx
/usr/local/php/sbin/php-fpm
/usr/local/nginx/sbin/nginx
# 在 nginx 的 html 目錄下放一個 php 文件,瀏覽器訪問,不能解析,顯示“ File not found.”