tail /var/log/messages //有报错请查看系统主日志文件
GRANT ALL PRIVILEGES ON . TO ‘root’@’%'IDENTIFIED BY ‘123’ WITH GRANT OPTION; 数据库授权
drop database xxx 删除数据库
*知识点:
a 源码编译 nginx 关联第三方模块,使用 mogoDB
使用户访问web页面,能直接跳转图片,图片存储在数据库mogoDB中
b 使用 rpm 命令 安装
mogodb 的安装源,或者自己定义安装源,进行非默认软件安装
关闭nginx
/usr/local/nginx/sbin/nginx -s stop
启动nginx
/usr/local/nginx/sbin/nginx
不停服务重新加载配置文件
/usr/local/nginx/sbin/nginx -s reload
单台LAMP架构(单点)–>升级为LAP+M 把数据库从服务器中剥离出来,从而实现单台服务器跑单业务(单服务)
注意:防火墙 selinux
1 web页面链接数据库时候,最后的数据库地址要写远程的数据库IP地址
2 一旦出现数据库连接失败,查看问题确认数据库库名服务是否启动数据库是否给web机器授权了
3 web页面的账号库名密码IP地址
4 如果出现多次数据库连接失败,建议将数据库的库删掉,重新创建一个库,重启服务,打开无痕重新连接。
5 远程库连上了,wordpress安装成功了
6 用户访问IP 是 webIP
当你项目2做完之后
企业来到了第三年–加入了NFS
a WEB A+P
b MARIADB
C NFS
删除a机器下 /var/www/html/*
wordpress代码放到NFS上然后共享出去
再使用a机器挂载
使用MySQL 5.7 安装
nginx使用yum安装
安装数据库mysql【www.mysql.com】
下载安装工具
[root@qf-docker ~]# yum -y install wget
下载数据库yum仓库的安装包
[root@qf-docker ~]# wget https://dev.mysql.com/get/mysql80-community-release- el7-3.noarch.rpm
安装数据库的yum仓库
[root@qf-docker ~]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm
修改数据库版本
[root@qf-docker ~]# yum -y install yum-utils
关闭8.0版本
[root@qf-docker ~]# yum-config-manager --disable mysql80-community
开启5.7版本
[root@qf-docker ~]# yum-config-manager --enable mysql57-community
安装数据库
[root@qf-docker ~]# yum -y install mysql mysql-server
安装nginx
[root@qf-docker ~]# yum -y install nginx
注意:使用虚拟机的同学需要安装epel源
[root@qf-docker ~]# yum -y install epel*
安装完成之后需要再次安装nginx
安装php
[root@qf-docker ~]# yum -y install php php-fpm php-mysql php-gd php-intl php- mcrypt php-mbstring php-xml php-dom
[root@qf-docker ~]# systemctl start mysqld php-fpm nginx
[root@qf-docker ~]# systemctl enable mysqld php-fpm nginx
查看原始密码:
[root@qf-docker ~]# cat /var/log/mysqld.log | grep password
495168Z 1 [Note] A temporary password is generated for root@localhost:
bo%lxfJtU5#p
修改数据库密码:
[root@qf-docker ~]# mysqladmin -u root -p'bo%lxfJtU5#p' password 'QianFeng@123' 登陆数据库,创建名为farm的数据库
[root@qf-docker ~]# mysql -u root -pQianFeng@123
mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.29 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database farm;
Query OK, 1 row affected (0.00 sec)
mysql> exit
Bye
nginx部署:
删除旧的配置文件:
[root@qf-docker ~]# rm -rf /etc/nginx/nginx.conf
生成新的配置文件
[root@qf-docker ~]# cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf
修改配置文件:
[root@qf-docker ~]# vi /etc/nginx/nginx.conf
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qkChGlvo-1604592376278)(C:\Users\admin\AppData\Roaming\Typora\typora-user-images\image-20201106000136178.png)]
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-kIoo5Ly9-1604592376280)(C:\Users\admin\AppData\Roaming\Typora\typora-user-images\image-20201106000156897.png)]
验证配置文件:
[root@bogon ~]# httpd -t
Syntax OK
php服务部署:
[root@qf-docker ~]# vim /etc/php.ini
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CAK8f1bJ-1604592376282)(C:\Users\admin\AppData\Roaming\Typora\typora-user-images\image-20201106000232553.png)]
[root@qf-docker ~]# systemctl restart nginx php-fpm
1.上传
2.解压
[root@qf-docker ~]# yum -y install unzip
[root@qf-docker ~]# unzip farm-ucenter1.5.zip 3.创建网站发布目录
[root@qf-docker ~]# mkdir /farm
4.项目拷贝
[root@qf-docker ~]# cp -r upload/* /farm/
5.设置权限
[root@qf-docker ~]# chmod 777 /farm/* -R
[root@qf-docker ~]# mysql -u root -pQianFeng@123 farm < upload/qqfarm.sql
8、浏览器访问
注意:
如果是使用的虚拟机操作 你需要:
临时关闭:
关闭防火墙:iptables -F
关闭selinux: setenforce 0
注意:unzip解压后注意是目录
[root@xingdian-qf /]# yum -y install httpd php php-fpm php-gd gd php-mysql
[root@xingdian-qf /]# yum -y install mariadb mariadb-server
[root@xingdian-qf /]# systemctl start httpd
[root@xingdian-qf /]# systemctl start mariadb
[root@xingdian-qf /]# systemctl start php-fpm
[root@xingdian-qf /]# vi /etc/httpd/conf.d/wordpress.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot /wordpress
</VirtualHost>
<Directory "/wordpress">
AllowOverride ALL
Require all granted
</Directory>
[root@xingdian-qf /]# rm -rf /etc/httpd/conf.d/welcome.conf
[root@xingdian-qf /]# systemctl restart httpd
[root@xingdian-qf /]# mysqladmin -u root password '123'
[root@xingdian-qf /]# mysql -u root -p123
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> exit
Bye
[root@xingdian-qf /]# unzip love.zip
[root@xingdian-qf /]# ls
love love.zip
[root@xingdian-qf /]# mkdir /wordpress
[root@xingdian-qf /]# cp -r love/* /wordpress
[root@xingdian-qf /]# chmod 777 /wordpress/* -R