天天看點

file not found. nginx php nginx 如何開啟解析 PHP 的功能

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;

這一句有問題,請再仔細查想一下為什麼?

重新開機nginx就可以解析php了。

# 啟動 php-fpm 和 nginx

/usr/local/php/sbin/php-fpm

/usr/local/nginx/sbin/nginx

# 在 nginx 的 html 目錄下放一個 php 檔案,浏覽器通路,不能解析,顯示“ file not found.”