WordPress个人博客搭建

搭建LNMP环境

请参考前面的博文自行搭建

部署WordPress

#创建数据库和用户
mysql -uroot -p123456 -S /data/3306/mysql.sock
create database wordpress;
show databases like "wordpress";
grant all on wordpress.* to wordpress@'127.0.0.1' identified by '123456';
flush privileges;
show grants for wordpress@'127.0.0.1';
select user,host from mysql.user;
quit

#修改Nginx配置文件
cd /application/nginx/
mkdir conf/extra
vim conf/extra/blog.conf

    server{
            listen 80;
            server_name blog.peterwang.org;
            root html/blog;
            index index.php index.html index.htm;
            location / {
            if (-f $request_filename/index.html){
                rewrite (.*) $1/index.html break;
            }
            if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
            }
            if (!-f $request_filename){
                rewrite (.*) /index.php;
            }
            }
            location ~ .*\.(php|php5)?$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi.conf;
            }
    }

vim conf/nginx.conf

...
include extra/blog.conf;
...

mkdir html/blog
chown -R nginx.nginx html/blog/
sbin/nginx -t
sbin/nginx -s reload

#安装WordPress
cd /server/tools
wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz
tar xf wordpress-4.8.1-zh_CN.tar.gz
mv wordpress/* /application/nginx/html/blog/

WordPress初始化

 

posted @ 2017-09-14 14:26  Peterer~王勇  阅读(451)  评论(0编辑  收藏  举报