编辑nginx配置文件并保存

vim /usr/local/nginx/conf/nginx.conf

location / {

            root   html;

            index  index.php index.html index.htm;

        }

location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            include        fastcgi_params;

        }

编辑PHP主页test文件并保存

vim ./<htdocs>/index.php

<?php

echo phpinfo();

?>

在你的浏览器中输入 URL: http://<server_ip_or_name>在页面中查看php测试页