linux服务器快速搭建wordpress个人博客

简单的搭建一个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' );
//数据库主机域

#) 访问博客,查看是否正常访问

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值