Simple Yum Installation Nginx+php+mysql
[Email protected] ~]# yum-y install php* mysql*
[Email protected] ~]# vim/etc/php-fpm.d/www.conf
Modify user and group to nginx users nobody
[Email protected] ~]# Vim/etc/php.ini #修改时间区
Date.timezone = asia/chongqing
Compile and install Nginx, do not need too many options,./configure--prefix=/usr/local/nginx
Modify Nginx config file, add PHP support
[Email protected] ~]# vim/usr/local/nginx/conf/nginx.conf
Location ~ \.php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param Script_filename/usr/local/nginx/html$fastcgi_script_name; #注意, in order to avoid the problem of egg ache, please enter absolute path
Include Fastcgi_params;
}
[[Email protected] ~] #service mysqld Restart #启动Mysql
[[Email protected] ~] #service php-fpm Restart #启动php-fpm process, PHP-FPM process for dynamic parsing of PHP files
[Email protected] ~]#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf #启动nginx进程
To see if the launch was successful:
1.
First look at the port:
[Email protected] ~]# Netstat-anptul|grep 80
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 26640/nginx
[Email protected] ~]# NETSTAT-ANPTUL|GREP 9000
TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 26656/php-fpm
To view the PHP-FPM process:
[[email protected] ~]# ps-ef|grep PHP
Root 1445 1 0 01:33? 00:00:00 Php-fpm:master Process (/etc/php-fpm.conf)
Apache 1446 1445 0 01:33? 00:00:00 Php-fpm:pool www
Apache 1447 1445 0 01:33? 00:00:00 Php-fpm:pool www
Apache 1448 1445 0 01:33? 00:00:00 Php-fpm:pool www
Apache 1449 1445 0 01:33? 00:00:00 Php-fpm:pool www
Apache 1450 1445 0 01:33? 00:00:00 Php-fpm:pool www
Root 1460 975 0 01:37 pts/0 00:00:00 grep php
2. Add phpinfo.php file to view php information of the website
[Email protected] ~]# vim/usr/local/nginx/html/phpinfo.php
<?php phpinfo ();?>
Save to exit
You can then see the native PHP details and support in the browser by entering http://ip/phpinfo.php.
This article is from the "Fate" blog, make sure to keep this source http://czybl.blog.51cto.com/4283444/1539001