可以試著更改match條件為對於所有php檔pass到fastcgi:如下:location ~ .*.php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcg\i_script_name;include fastcgi_params; }先看看php跑的對不對再來debug你的document_root設定另外一種可能的解法是設定link:sudo ln -sv /var/work/php /var/work/nginx_rootls -la /var/work/nginx_root/phpAccess URL:
http://localhost/php/test.php