安装Php和php 扩展
sudo yum install php php-mysql php-fpm php-mbstring php-gd php-pear php-mcrypt php-mhash php-eaccelerator php-cli php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mssql php-snmp php-soap php-tidy php-common php-devel php-pecl-xdebug -y
编辑php配置文件
sudo vi /etc/php.ini
cgi.fix_pathinfo=0
sudo vi /etc/php-fpm.d/www.conf
listen = /var/run/php-fpm/php-fpm.sock
启动php-fpm服务
sudo systemctl start php-fpm
sudo systemctl enable php-fpm.service
配置nginx站点:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
更详细的介绍参见:
http://blog.csdn.net/yz972641975/article/details/52577018