1. 程式人生 > >Linux 下Wordpress博客搭建

Linux 下Wordpress博客搭建

.cn ref root用戶 lis load mysql creat -h itl

Wordpress

# 下載安裝文件

cd /usr/local/nginx/html/blog
wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz
tar xf wordpress-4.8.1-zh_CN.tar.gz
cd wordpress                          -->可以將文件移到
關於文件權限的考慮 PHP文件是root用戶,因為是開發管理/usr/local/nginx/html/blog,避免頁面顯示多路徑
cd /usr/local/nginx/html
chown -R root.root ./blog
find ./blog/ -type f|xargs chmod 644
find ./blog/ -type d |xargs chmod 755

更改頭像 附件的權限
mkdir -p /usr/local/nginx/html/blog/wordpress/wp-content/uploads
chown nginx.nginx /usr/local/nginx/html/blog/wordpress/wp-content/uploads

添加數據庫信息

mysql -uroot -proot
create database wordpress;
show databases;
grant all on wordpress.* to wordpress@‘localhost‘ identified by ‘root‘;
    ==>grant all on wordpress.* to wordpress@‘192.168.25.%‘ identified by ‘root‘;
flush privileges;

select user,host from mysql.user;
遠程連接數據庫:mysql -ubbs -proot -h 192.168.25.144 

更改首頁為動態:

vim /usr/local/nginx/conf/extra/blog.conf
 server {
        listen       88;
        server_name  www.blog.com;
        root   html/blog;
        location / {
            index  index.php index.html index.htm;
        }
        location ~.*\.(php|php5)?$ {
             fastcgi_pass  127.0.0.1:9000;
             fastcgi_index index.php;
             include  fastcgi.conf;
        }
        access_log logs/access_blog.log main;
    }

設置頁面顯示

http://www.blog.com:88/wordpress/index.php

技術分享圖片

添加wp-config.php配置信息

 vim /usr/local/nginx/html/blog/wordpress/wp-config.php 

mysql中查看數據:

use wordpress;
select * from ftl_posts\G;

技術分享圖片

技術分享圖片

登錄界面:

http://www.blog.com:88/wordpress/wp-login.php

技術分享圖片

Linux 下Wordpress博客搭建