1 : View environment:
1[ root@localhost ~]# cat /etc/redhat-release
2 : Turn off the firewall
1 # Take effect after restart
2[ root@localhost ~]# chkconfig iptables off
34 or
56 # Immediate effect,Failed to open after restart
7[ root@localhost ~]# service iptables stop
Close selinux
# Effective immediately, invalid after restart
[ root@localhost ~]#setenforce 0//SELINUX=Modify enforcing to disabled and restart to take effect[root@localhost ~]# vi /etc/selinux/config
1[ root@localhost ~]#wget http://www.atomicorp.com/installers/atomic
23[ root@localhost ~]#sh ./atomic
45[ root@localhost ~]#yum check-update
4 : Install the development kit and library files
1 # Be careful not to wrap
2[ root@localhost ~]#yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-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 levels to start up
7 : Install mysql
# yum install mysql mysql-server mysql-devel
# service mysqld start
# chkconfig --levels 235 mysqld on
//Log in to MySQL to delete empty users and change 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 wrap
# yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap
//Install PHP and required components to make PHP support MySQL, FastCGI mode
# yum install php-tidy php-common php-devel php-fpm php-mysql
# service php-fpm start
# chkconfig --levels 235 php-fpm on
9 : Configure nginx to support php
//Change configuration file to backup file
# mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak
//Since the original configuration file has to be written by yourself, you can use the default configuration file as the configuration file
# cp /etc/nginx/nginx.conf.default/etc/nginx/nginx.conf
//Modify the server section of the nginx configuration file and add fastcgi support
# vi /etc/nginx/nginx.conf
//Join index.php
index index.php index.html index.htm;//Remove the following code comments and modify it to the default path of nginx
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 at the end of the file.fix_pathinfo = 1 [root@CentOS ~]# vi /etc/php.ini
11 : Restart nginx php-fpm
# service nginx restart
# service php-fpm restart
12 : Create info.php file
# vi /usr/share/nginx/html/info.php
<? php
phpinfo();?>
13 : Test whether nginx can parse php
Local browser input: 192.168.32.164/info.php
Show that the phpinfo interface environment is successfully built
Recommended Posts