在 /etc/nginx/conf.d 目录中新建一个名为 php.conf 的文件,并配置 Nginx 端口
server {
listen 8000;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$ {
root /usr/share/php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
这时候,我们就可以在/usr/share/php 目录下新建一个 info.php 文件来检查 php 是否安装成功了