测试PHP解析

● 配置nginx配置文件
○ vim /usr/local/nginx/conf/nginx.conf

● 取消下列各行的注释,并修改 SCRIPT_FILENAME/usr/local/nginx/html$fastcgi_script_name
○ location ~ .php$ {
○ root html;
○ fastcgi_pass 127.0.0.1:9000;
○ fastcgi_index index.php;
○ fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
○ include fastcgi_params;
○ }
● 测试配置文件是否正确
○ /usr/local/nginx/sbin/nginx -t
● 若正确则表明正确
○ nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
○ nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

● 重新加载配置文件
○ /usr/local/nginx/sbin/nginx -s reload

● 创建测试文件
○ vim /usr/local/nginx/html/info.php
○ <?php
○ phpinfo();
○ ?>

● 在浏览器中输入ip地址,若访问成功则PHP解析成功