安裝好nginx + php-fpm 後,ngixn error log出現以下錯誤訊息
2017/06/28 10:06:46 [error] 949#100116: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.77.252, server: ng.test.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "example.com:8080"

預設參考範例
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        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;
        }

修改為以下設定
        location ~ \.php$ {
            #root           html;
            root             "你的網頁路徑";
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

重新啟動nginx 即可


undefined
MIS 一定要懂的82個伺服器建置與管理知識
作者: きはし まさひろ  
譯者: 陳禹豪, 黃瑋婷
出版社:旗標

arrow
arrow
    文章標籤
    nginx php php-fpm
    全站熱搜

    helloworld 發表在 痞客邦 留言(0) 人氣()