1: View the Environment:
[Root@localhost ~]# Cat/etc/redhat-release
2: Turn off the firewall
#重启后生效开启
[root@localhost ~]# chkconfig iptables off
or
#即时生效, fail-Open after reboot
[root@localhost ~]# Service Iptables stop
Close SELinux
#即时生效, failure after reboot
[root@localhost ~] #setenforce 0
//change selinux=enforcing to Disabled then restart effective
[root@localhost ~ ]# Vi/etc/selinux/config
3. Configure CentOS 6.7 Third party yum Source (CentOS no Nginx package in the default standard source)
[root@localhost ~] #wget http://www.atomicorp.com/installers/atomic
[root@localhost ~] #sh./atomic
[ Root@localhost ~] #yum check-update
4: Installation of the contract and library files
Copy Code code as follows:
#注意不要换行
[root@localhost ~] #yum-y install ntp make OpenSSL openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-de vel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libxpm libxpm-devel ncurses ncurses-devel libmcrypt Libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 Curl Curl-devel
5: Uninstall the installed Apache, MySQL, PHP
# yum Remove httpd
# yum remove MySQL
# yum remove php
6: Install Nginx
# yum Install nginx
# service Nginx start
# chkconfig--levels 235 nginx on //Set 2, 3, 5 level do not boot
7: Install MySQL
# yum install MySQL mysql-server mysql-devel
# service mysqld start
# chkconfig--levels 235 mysqld on
//login Mys QL deletes the null user, modifies the root password
mysql>select user,host,password from Mysql.user;
Mysql>drop user ' @localhost;
Mysql>update mysql.user Set Password = password (' Your password ') where user= ' root ';
Mysql>flush privileges;
8: Install PHP
Also be careful not to change lines
# yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml ph P-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap
/install PHP and required components to enable PHP to support MySQL, fastcgi mode
#yum Install Php-tidy Php-common php-devel php-fpm php-mysql
# service php-fpm start
# chkconfig--levels 235 On
9: Configure Nginx support PHP
Change profile to back up file
# Mv/etc/nginx/nginx.conf/etc/nginx/nginx.confbak
///Because the original profile has to be written on its own so you can use the default profile as the configuration file
# cp/etc/nginx/nginx.conf.default/etc/nginx/nginx.conf
//Modify Nginx configuration File server segment, add fastcgi support
# vi/etc/nginx/ nginx.conf
//Join index.php
index index.php index.html index.htm;
Remove the following code comment and modify it to the Nginx default path
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;
}
10: Configure PHP
Edit file php.ini, add cgi.fix_pathinfo = 1
[Root@centos ~]# Vi/etc/php.ini at end of file
11: Restart Nginx php-fpm
# Service Nginx Restart
service php-fpm restart
12: Establish info.php files
# vi/usr/share/nginx/html/info.php
<?php
phpinfo ();
? >
13: Test Nginx Whether you can parse PHP
Local browser input: 192.168.32.164/info.php
Show Phpinfo interface Environment built successfully