文章目录
简单的搭建一个wordpress博客
环境准备,上传wordpress包
配置php的yum源
下载数据库,php71w,nginx
进入数据库创建一个wordpress库
准备一个虚拟主机
创建www用户
nginx的运行用户
解压wordpress压缩包,并且重新授权
解决mysql反向解析问题,在/etc/my.cnf添加一行参数(在mysqld服务端添加)
启动服务
修改wp-config-sample.php内部的配置文件
简单的搭建一个wordpress博客
环境准备,上传wordpress包
mkdir /code cd /code/
配置php的yum源
cat /etc/yum.repos.d/php.repo
[php]
name = php Repository
baseurl = http://us-east.repo.webtatic.com/yum/el7/x86_64/
gpgcheck = 0
下载数据库,php71w,nginx
yum install mariadb* nginx -y
yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb
进入数据库创建一个wordpress库
create database wordpress;
#)创建授权用户
grant all on wordpress.* to 'wordpress'@'%' identified by '123456';
#) 创建一个远程数据库
准备一个虚拟主机
[root@klaus wordpress]#cat /etc/nginx/conf.d/blog.conf
server {
listen 80;
server_name www.xiejun1.top;
root /code/wordpress;
location / {
index index.php index.html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
#) 修改php的运行用户/etc/php-fpm.d/www.conf改为和nginx相同的用户
创建www用户
groupadd www -g666
useradd www -u666 -g www
nginx的运行用户
sed -i '/^user /c user nginx;' /etc/nginx/nginx.conf
#php的运行用户
sed -i '/^user/c user = nginx' /etc/php-fpm.d/www.conf
sed -i '/^group/c group = nginx' /etc/php-fpm.d/www.conf
解压wordpress压缩包,并且重新授权
tar xf wordpress-5.2.2.tar.gz
chown -R nginx.nginx /code/
解决mysql反向解析问题,在/etc/my.cnf添加一行参数(在mysqld服务端添加)
server_id=1
log-bin=mysql-bin
skip-grant-tables
启动服务
systemctl start nginx
systemctl start php-fpm
systemctl start mariadb
修改wp-config-sample.php内部的配置文件
vim wp-config-sample.php
// ** MySQL settings - You can get this info from your web host ** /
/ /** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' ); //数据库库名
/** MySQL database username */
define( 'DB_USER', 'wordpress' ); //数据库远程连接用户
/** MySQL database password */
define( 'DB_PASSWORD', '123456' ); //数据库远程用户密码
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
//数据库主机域
#) 访问博客,查看是否正常访问