/************************************************************************* * CentOS 6.6 nginx PHP Configuration * Description: * Install nginx PHP configuration on VPS for some time boring use. * 2016-11-26 Shenzhen Nanshan Ping Shan village Zengjianfeng ********************************************************* ***************/First, reference documents:1. Centos6.5Yum installation configuration Lnmp server (nginx+php+MySQL) http://blog.csdn.net/lane_l/article/details/20235909 2. php-FPM does not automatically start after reboot http://Serverfault.com/questions/459728/php-fpm-does-not-automatically-start-after-reboot 3. OpenBSD.Nginx.MySQL.PHP Environment Building Manual http://www.360doc.com/content/10/1211/11/4330887_77027995.shtmlii. Installation: Yum install php yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath Php-mhash Libmcrypt Libmcrypt-devel php-FPM III, test PHP-cgi:php-cgi-b127.0.0.1:9000Four, the background to run PHP-CGI:1. /etc/rc.d/init.d/php-fpm Start2. Chkconfig php-fpm on Five, nginx configuration: [[email protected]/]# cat/etc/nginx/conf.d/php.conf server {Listen8080; server_name localhost; #charset Koi8-R; #access_log/var/log/nginx/log/Host.access.log Main; Location/{root/home/zengjf/www; Index index.php index.html index.htm; } #error_page404/404. html; # REDIRECT Server error pages to theStaticPage/50x.html # Error_page - 502 503 504/50x.html; Location= /50x.html {root/usr/share/nginx/html; } # Proxy The PHP scripts to Apache listening on127.0.0.1: the# #location~\.php$ {# Proxy_pass http://127.0.0.1;#} # Pass the PHP scripts to FastCGI server listening on127.0.0.1:9000# Location~\.php$ {root/home/zengjf/www; Fastcgi_pass127.0.0.1:9000; Fastcgi_index index.php; Fastcgi_param script_filename $document _root/$fastcgi _script_name; Include Fastcgi_params; } # Deny access to. htaccess files,ifApache's Document Root# concurs with Nginx'S One# #location~ /\.ht {# deny all; #}} [[email protected]/]#
CentOS 6.6 nginx PHP Configuration