Before installing, you can first look at the lamp installation process
http://blog.csdn.net/zph1234/article/details/51248124
1. Installing Nginx
Yum install yum-priorities-y wget http://nginx.org/packages/centos/7/noarch/RPMS/ nginx-release-centos-7-0.el7.ngx.noarch.rpm rpm-ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm Yum Install Nginx
Systemctl start Nginx.service #启动nginx systemctl stop nginx.service #停止 systemctl restart Nginx.service #重启
2. Change the Nginx port number (depending on your needs)
cd/etc/nginx/conf.d/ vim default.conf Change Listen 80 to listen 81
Systemctl Restart Nginx.service #重启nginx
3. Visit http://ip:81 to see Nginx homepage
4. Next Installation PHP-FPM
Yum Install PHP-FPM
Systemctl start Php-fpm.service #启动php-fpm systemctl enable Php-fpm.service #设置开机启动
5. Change Nginx config file to identify PHP
Vi/etc/nginx/conf.d/default.conf, the previous # to get rid of it, you can change the Fastcgi_param
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; }
6.
Create a new test.php in/usr/share/nginx/html
Visit http://ip:81/test.php to see the PHP page in Nginx
The above describes the lnmp of CentOS, including the contents of the content, I hope that the PHP tutorial interested in a friend helpful.