close

學程式的道路上.....我跌跌撞撞的過程

文章為我平時發生錯誤的解決方法

因為擔心下次碰到時會忘記

所以就將他筆記下來了

如果有大大發現我的敘述錯誤

或者有哪些更有效率的方法

也請大大們不吝嗇的提供指教

謝謝~


今天碰到Nginx 讀取PHP檔案時,出現File not fiund的問題,問題原因就在(etc/nginx/nginx.conf)這一支設定檔
 
錯誤版本 : 因為$document_root 為空直,所以指不到正確路徑
    server {
        server_name mangosteen-dev.net;
        root /home/newcasino/mangosteen/public;
        index index.html index.php index.htm;
 
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
 
        location ~ \.php$ {
            root           html;
            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;
        }
 
    }
 
 
正確版本 : 填寫絕對路徑後,就可以找到檔案了
    server {
        server_name mangosteen-dev.net;
        root /home/newcasino/mangosteen/public;
        index index.html index.php index.htm;
 
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
 
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param SCRIPT_FILENAME  /home/newcasino/mangosteen/public$fastcgi_script_name;
            include        fastcgi_params;
        }
 
    }
 
arrow
arrow
    文章標籤
    nginx php-fpm File not found
    全站熱搜

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