5.LNMP(Linux + Nginx + MySQL + PHP)环境安装

1.安装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 -y install nginx
systemctl start nginx.service
systemctl stop nginx.service
systemctl restart nginx.service
systemctl enable nginx.service

2.安装php (使用FastCGI方式)

yum -y install php php-fpm
systemctl start php-fpm.service
systemctl enable php-fpm.service
vi /etc/nginx/conf.d/default.conf
cat /etc/nginx/conf.d/default.conf
-------------------------------------------------------
里面加入了下面这段:
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
--------------------------------------------------------
cd /usr/share/nginx/html/
vi test.php
cat test.php
-----------------------------
<?php
phpinfo():
?>
-----------------------------
systemctl restart php-fpm
systemctl restart nginx
systemctl restart php-fpm  

  

浏览器访问验证:

5.LNMP(Linux + Nginx + MySQL + PHP)环境安装

Yum安装MySQL参考:

最后还需要执行一条:

yum -y install php-mysql

  

上一篇:CocoaPods 建立私有仓库


下一篇:js实现复选框全选/全不选/反选