安装php及其pdo、mysql等扩展
yum install php71w php71w-fpm php71w-cli php71w-common php71w-devel php71w-gd php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath
启动php
/bin/systemctl start php-fpm.service
修改nginx配置文件
vim /etc/nginx/conf.d/nginx.conf
在该文件中编辑:
server{
listen 80;
client_max_body_size 1024m;
server_name hangjia.bcfin.net;
root /var/www/web/hangjia_peizi/public;
location / {
index index.php index.html index.htm;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php/$1;
}
}
location ~ \.php {
include fastcgi_params;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_read_timeout 600;
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
}
location ^~ /data/runtime {
return 404;
}
location ^~ /application {
return 404;
}
location ^~ /simplewind {
return 404;
}
}
在您的/var/www/test/ 目录下编辑index.php文件 并输入phpinfo();
之后再浏览器输入您的域名:**********即可查看到如下图信息:
![](https://box.kancloud.cn/fdb789604c2f88a3990c3222165c88ab_663x538.png)