Home > Backend Development > PHP Tutorial > Construction of Lnmp on Centos

Construction of Lnmp on Centos

WBOY
Release: 2016-07-28 08:27:05
Original
1122 people have browsed it

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  
Copy after login

systemctl start nginx.service #启动nginx  

systemctl stop nginx.service #停止  

systemctl restart nginx.service #重启  
systemctl enable nginx.service #设置开机启动 
Copy after login

2. Change the nginx port number ( According to your own needs)
    cd /etc/nginx/conf.d/  
    vim default.conf  
    把listen 80改成listen 81  
Copy after login

    systemctl restart nginx.service #重启nginx  
Copy after login

3. Visit http://ip:81 to see the nginx homepage

4. Next step to install php-fpm
yum install php-fpm  
Copy after login

    systemctl start php-fpm.service #启动php-fpm  
    systemctl enable php-fpm.service #设置开机启动  
Copy after login
5. Change the nginx configuration file to identify php

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;  
}
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template