001.WordPress建站部署

一 WordPress简介

WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PHP和MySQL数据库的服务器上架设属于自己的网站。也可以把 WordPress当作一个内容管理系统CMS)来使用。
本内容基于Linux的LAMP平台构建个人博客站点。

二 环境

  • LAMP平台
  • 域名:www.imxhy.cn
  • IP:172.24.8.100

三 部署

3.1 Linux服务器上部署LAMP环境

注意:可采用yum快速部署,并安装相应php-mysql。
[root@imxhy ~]# yum install wget unzip httpd mariadb-server mariadb php php-mbstring php-mysql php-gd

3.2 下载对应的程序包

https://cn.wordpress.org/,官网下载对应的程序包。
https://cn.wordpress.org/wordpress-4.7.4-zh_CN.tar.gz

3.3 上传程序并解压

将程序上传至Linux服务器/root/mytmp
[root@imxhy mytmp]# tar -xzf wordpress-4.5.3-zh_CN.tar.gz #解压WordPress
[root@imxhy mytmp]# mkdir -p /var/www/html/wordpress/ #创建WordPress的网页主目录
[root@imxhy mytmp]# cp wordpress/* /var/www/html/wordpress/ #复制WordPress至网页主目录

3.4 配置并修改

新建Apache虚拟机
  1 [root@imxhy ~]# cp /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /etc/httpd/conf.d/vhosts.conf
  2 [root@imxhy conf.d]# vi vhosts.conf
  3 <VirtualHost *:80>
  4 ServerAdmin x120952576@126.com					#管理者邮箱
  5 DocumentRoot "/var/www/html/wordpress"				#主目录
  6 ServerName imxhy.cn							#域名
  7 ServerAlias www.imxhy.com
  8 ErrorLog "/var/log/httpd/imxhy_error"
  9 CustomLog "/var/log/httpd/imxhy_access" common
 10 </VirtualHost>
 

四 测试并链接数据库

浏览器输入172.24.8.100

4.1 创建数据库

  1 [root@imxhy conf.d]# mysql_secure_installation		#建议设置相关安全性
  2 MariaDB [(none)]> create databases wordpress;
  3 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'databases wordpress' at line 1
  4 MariaDB [(none)]>
  5 MariaDB [(none)]>
  6 MariaDB [(none)]> create database wordpress;       		#创建一个新的数据库WordPress
  7 Query OK, 1 row affected (0.00 sec)
  8 MariaDB [(none)]> grant all privileges on *.* to mysql@'localhost' identified by 'x7374521*'; #新建最高权限的管理账户mysql
  9 Query OK, 0 rows affected (0.00 sec)
 10 MariaDB [(none)]> grant all privileges on wordpress.* to xhy@'localhost' identified by 'x120952576'; #新建对WordPress具有所有权限的账户xhy
 11 Query OK, 0 rows affected (0.00 sec)
 12 MariaDB [(none)]> flush privileges;				#刷新权限
 13 Query OK, 0 rows affected (0.00 sec)
 
01

4.2 其他配置

  1 [root@imxhy ~]# chown -R apache /var/www/html/wordpress/
  2 [root@imxhy ~]# systemctl restart httpd.service
 

五 建立数据表

5.1 登录WordPress

02
#填入之前创建的数据库名字和密码
03
#创建站点相关信息
04
#测试成功
原文地址:https://www.cnblogs.com/itzgr/p/9962540.html