Linux 下Wordpress博客搭建

Wordpress

# 下載安裝文件php

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


更改頭像  附件的權限html

mkdir -p /usr/local/nginx/html/blog/wordpress/wp-content/uploads
chown nginx.nginx /usr/local/nginx/html/blog/wordpress/wp-content/uploads
cp -rf wordpress/* /usr/local/nginx/html/blog/wordpres/ # 複製安裝文件

添加數據庫信息java

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 

更改首頁爲動態:mysql

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;
    }

重啓Nginx服務器nginx

service nginx restart

設置頁面顯示sql

http://www.blog.com:88/wordpress/index.php       # 具體IP依賴Nginx設置,可是都是index.php文件shell

 

添加wp-config.php配置信息數據庫

 vim /usr/local/nginx/html/blog/wordpress/wp-config.php 
 1 <?php
 2 /**
 3  * WordPress基礎配置文件。
 4  *
 5  * 這個文件被安裝程序用於自動生成wp-config.php配置文件,
 6  * 您能夠不使用網站,您須要手動複製這個文件,
 7  * 並重命名爲「wp-config.php」,而後填入相關信息。
 8  *
 9  * 本文件包含如下配置選項:
10  *
11  * * MySQL設置
12  * * 密鑰
13  * * 數據庫表名前綴
14  * * ABSPATH
15  *
16  * @link https://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
17  *
18  * @package WordPress
19  */
20 
21 // ** MySQL 設置 - 具體信息來自您正在使用的主機 ** //
22 /** WordPress數據庫的名稱 */
23 define('DB_NAME', 'wordpress');
24 
25 /** MySQL數據庫用戶名 */
26 define('DB_USER', 'wordpress');
27 
28 /** MySQL數據庫密碼 */
29 define('DB_PASSWORD', 'root');
30 
31 /** MySQL主機 */
32 define('DB_HOST', 'localhost');
33 
34 /** 建立數據表時默認的文字編碼 */
35 define('DB_CHARSET', 'utf8mb4');
36 
37 /** 數據庫整理類型。如不肯定請勿更改 */
38 define('DB_COLLATE', '');
39 
40 /**#@+
41  * 身份認證密鑰與鹽。
42  *
43  * 修改成任意獨一無二的字串!
44  * 或者直接訪問{@link https://api.wordpress.org/secret-key/1.1/salt/
45  * WordPress.org密鑰生成服務}
46  * 任何修改都會致使全部cookies失效,全部用戶將必須從新登陸。
47  *
48  * @since 2.6.0
49  */
50 define('AUTH_KEY',         '_{Z0KbCi~SsSk4HmIT-+CnLX<[]xg72@?R32D*HK}wDQ)odhFgg0o&t% u]6jdGb');
51 define('SECURE_AUTH_KEY',  ' >`HA%z3<KDYf%3Z<*>}9u4tnaPOOXo6;U$[1lHdT.oxbH:T8eJDxOU5/!5WhaAH');
52 define('LOGGED_IN_KEY',    '-w|,h,Ks&$2#f(sjj.-I-Vp{.LFs_fEn<:K0v{bc6v03^Lm0lMCnfR]j0n:lA:a4');
53 define('NONCE_KEY',        '3pihWG18qc/2-/ %iK@ORAQXX _Rujxd^F49^.2-f</1L$xc@<>ra$U67ydT}yK1');
54 define('AUTH_SALT',        'y*j8[|4D,faS~Ur1yO#J7|oBl5~o.4 ZbKQ{0h0|LRh(9}elsfjS0r>/Y}y:QEmz');
55 define('SECURE_AUTH_SALT', 'L1`x,XGf7vdhauV`J+d#yDSQ;L#`U m/f<xz>t.$A{x@CHN}COugp^k3pj!C`B`B');
56 define('LOGGED_IN_SALT',   '|zt*+S&9_C6xG.U8H9=bp7m(4cJ&bC]_)f0CDrIbtC=_?2uco&LJ0S5vJjw*Qs2}');
57 define('NONCE_SALT',       '139^{p;GSJF!Xn7XX.HlK#$7xItGvQ}&=8[/tzsz65:bM^LGrJdtE C(RNR6Zilx');
58 
59 /**#@-*/
60 
61 /**
62  * WordPress數據表前綴。
63  *
64  * 若是您有在同一數據庫內安裝多個WordPress的需求,請爲每一個WordPress設置
65  * 不一樣的數據表前綴。前綴名只能爲數字、字母加下劃線。
66  */
67 $table_prefix  = 'ftl_';
68 
69 /**
70  * 開發者專用:WordPress調試模式。
71  *
72  * 將這個值改成true,WordPress將顯示全部用於開發的提示。
73  * 強烈建議插件開發者在開發環境中啓用WP_DEBUG。
74  *
75  * 要獲取其餘能用於調試的信息,請訪問Codex。
76  *
77  * @link https://codex.wordpress.org/Debugging_in_WordPress
78  */
79 define('WP_DEBUG', false);
80 
81 /**
82  * zh_CN本地化設置:啓用ICP備案號顯示
83  *
84  * 可在設置→常規中修改。
85  * 如需禁用,請移除或註釋掉本行。
86  */
87 define('WP_ZH_CN_ICP_NUM', true);
88 
89 /* 好了!請不要再繼續編輯。請保存本文件。使用愉快! */
90 
91 /** WordPress目錄的絕對路徑。 */
92 if ( !defined('ABSPATH') )
93     define('ABSPATH', dirname(__FILE__) . '/');
94 
95 /** 設置WordPress變量和包含文件。 */
96 require_once(ABSPATH . 'wp-settings.php');
View Code

 

 

 

 

 

 

 

開始安裝wordpressvim

安裝完成api

登陸帳戶:

 

mysql中查看數據:

use wordpress;
select * from ftl_posts\G;

image

image

登陸界面:

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

image

 

【更多參考】

關於Mysql和WordPress離線/在線部署的配置文件

相關文章
相關標籤/搜索