最简单方式手工搭建lnmp(灵活指定版本)+wordpress上云(看完不会来打我)

1.nginx

写入源:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/x86_64/
gpgcheck=0
enabled=1

安装

yum install nginx跟任意版本号
例如: yum install nginx-1.8.0

2.mysql

这里为mysql8.0,需要修改版本的自己在yum源启用其他版本

写入源:

wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

安装:

yum -y install mysql80-community-release-el7-3.noarch.rpm
yum -y install mysql-community-server

启动MySQL服务:

systemctl start  mysqld.service

获取密码:

grep "password" /var/log/mysqld.log

登录修改密码:

mysql -uroot -p

改密码:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Lang@zuo123.';

将密码设置规范修改一下:

set global validate_password.policy=0;
set global validate_password.length=1;

改root为简单密码:

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

设置远程连接:

update user set host = '%'  where user = 'root'; 

设置密码策略:

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; 

查询策略:

select user,plugin from user;

在这里插入图片描述

3.php(支持所有版本,需在yum.repos.d下手动开启)

1.安装源

 yum install epel-release -y
 yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y

2.安装YUM管理工具

 yum install yum-utils -y

3.安装

 yum install php74-php-gd  php74-php-pdo php74-php-mbstring php74-php-cli php74-php-fpm php74-php-mysqlnd

4.启动

systemctl start php74-php-fpm 

4.nginx代理php

1.改php代理用户与组:

vim /etc/opt/remi/php74/php-fpm.d/www.conf

搜索修改apache改为nginx

2.重启php

systemctl restart php74-php-fpm 

3.更改nginx代理配置

vim /etc/nginx/conf.d/default.conf 

1.加入index.php
原:

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
}

改:

location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm index.php;
    }

2.修改php脚本路径为nginx默认目录
改 /scripts为$document_root

原:

location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        include        fastcgi_params;
    }

改:

 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        fastcgi_params;
    }

重启nginx写入php测试文件

systemctl restart nginx && echo "<?php  phpinfo(); ?>"  > /usr/share/nginx/html/index.php

测试代理:

http://ip/index.php

提示:如果做到这一步没有测试成功php代理,建议不学运维,改其他行业

5.wordpress上云

1.下载wordpress最新版:

wget https://cn.wordpress.org/latest-zh_CN.tar.gz

2.将文件解压并复制到html下(去掉wordpress目录方式)

tar -xvf latest-zh_CN.tar.gz
cp -rvf wordpress /usr/share/nginx/html/

3.修改所属用户与组:

chown nginx:nginx html -R

4.创建数据库wordpress

create database wordpress;

4.重启并访问nginx(二选一)

http://139.186.151.145/index.php
http://ip/wp-admin/setup-config.php

配置如下:
在这里插入图片描述
其他根据自己需求

6.wrodpress上云结束结束

在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

霖宇长清

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值