Before installing, you can take a look at the lamp installation process
http://blog.csdn.net/zph1234/article/details/51248124
1. Install 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 #重启 systemctl enable nginx.service #设置开机启动
cd /etc/nginx/conf.d/ vim default.conf 把listen 80改成listen 81
systemctl restart nginx.service #重启nginx
3. Visit http://ip:81 to see the nginx homepage
4. Next step to install php-fpmyum install php-fpm
systemctl start php-fpm.service #启动php-fpm systemctl enable php-fpm.service #设置开机启动
vi / etc/nginx/conf.d/default.conf, just remove the previous # and change 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 introduces the construction of Lnmp in Centos, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.