Add nginx default Home page index.php
Vim/etc/nginx/conf.d/default.conf
Location/{
root/usr/share/nginx/html;
Index index.html index.htm index.php;
}
Configuring Nginx Support PHP
Vim/etc/nginx/conf.d/default.conf
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
Location ~. php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param Script_filename/usr/share/nginx/html$fastcgi_script_name;
Include Fastcgi_params;
}
Configure PHP-FPM
Vim/etc/php-fpm.d/www.conf
; Unix User/group of processes
; Note:the user is mandatory. If The group is not set, the default user ' s group
; would be used.
; Rpm:apache choosed to being able to access some dir as httpd
user = Nginx
; Rpm:keep a group allowed to write in log dir.
Group = Nginx
Chkconfig php-fpm on #设置php-fpm self-priming
Chkconfig mysqld on #设置mysqld自启动
Service Nginx Restart #重新启动nginx
Service PHP-FPM start #启动php-fpm
Service mysqld Start #启动mysqld
Configure Nginx to support PHP under CentOS