目录
LNMP的介绍:
LNMP组合工作流程:
FastCGI介绍:
1、什么是 CGI
2、什么是 FastCGI
配置LNMP
1、部署LNMP环境
安装国内的epel:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
部署LNMP环境:
yum install nginx mariadb-server php php-mysql php-gd php-fpm -y
2、配置LNMP环境
数据库:
mysql -e 'create database wordpress charset utf8'
mysql -e 'grant all on wordpress.* to wordpress@localhost identified by "123456"'
php-fqm:
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.php index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
测试nginx和php协同:
[root@node1 conf.d]# echo "<?php phpinfo(); ?>" >/usr/share/nginx/html/test.php
[root@node1 conf.d]# systemctl restart nginx
浏览器访问:ip地址/test.php
测试mysql和php协同:
下载好下载 WordPress 的压缩包文件:wordpress-4.8-zh_CN.tar.gz
解压到nginx默认的HTML测试页面
tar xf wordpress-4.8-zh_CN.tar.gz -C /usr/share/nginx/html/
启动环境:
systemctl restart nginx mariadb php-fpm
浏览器访问:ip地址/wordpress,并根据提示部署