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上云结束结束
转载:https://blog.csdn.net/kingoflongevity/article/details/115862420
查看评论