快速簡單搭建wordpress平臺

 
公司一直沒有文檔平臺,因而想弄一個,弄過github平臺的,可是都沒用上,雖然這個搭建出來也沒用上,仍是花了時間才弄出來的,也許下次有用的時候,能夠拿來就用
 

安裝Wordpress的基礎環境要求

一、Mysql
二、PHP
三、nginx
 

1、安裝mysql

一、安裝mysql
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server

 

二、啓動mysql
systemctl start mysqld

 

三、獲取默認密碼
grep "password" /var/log/mysqld.log 

 

四、登陸mysql
mysql -uroot -p

 

五、修改密碼
mysql> alter user 'root'@'localhost' identified by 'Lile@5201314';

 

六、建立wordpress數據庫並受權
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> create user 'wordpress'@'localhost' identified by 'Wordpress@5201314';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all privileges on wordpress.* to 'wordpress'@'localhost';
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

 

2、安裝nginx

一、安裝nginxphp

 

yum install nginx -y

 

二、添加配置文件
 
vim /etc/nginx/conf.d/wordpress.conf
server {
    listen 80;
    server_name  opswordpress.transspay.net;
    root /wordpress;
    location / {
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php index.php;
    }
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ .php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

 

三、重啓nginx
 
nginx -s reload

 

3、安裝php

#安裝
yum install php-fpm php-mysql -y

#啓動
systemctl start php-fpm.service

#9000爲php-fpm的默認端口
lsof -i:9000

 

4、下載wordpress

一、下載解壓
https://wordpress.org/latest.tar.gz

 

2)設置wp-config.php文件,根據本身的數據庫修改相關的配置
cp wp-config-sample.php wp-config.php
define( 'DB_NAME', 'wordpress' );

/** MySQL database username */
define( 'DB_USER', 'wordpress' );

/** MySQL database password */
define( 'DB_PASSWORD', 'wordpress@5201314' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

 

設置祕鑰的部分,能夠在官網獲取: https://api.wordpress.org/secret-key/1.1/salt/  
define('AUTH_KEY',         'h#f>^]S]8_%v|c5y8$r{;OOQ1SWuFV4`1Tk^g=MImlUQ`Z{x(;^aMo)yFvm6}zJ;');
define('SECURE_AUTH_KEY',  'h+Qs$r|5t[^I,}H[$s/~n+)Jt4#<{=D|@RtZU.LJa pX dupeRrUE4Cra-^Bhb)2');
define('LOGGED_IN_KEY',    'zbZEh/#7wZYk_Bz4>t}W-~L{}s8V$!0qLl/*{z^tWj6A}~!3i1I!9Iv`~L>|0z[J');
define('NONCE_KEY',        ';ou7nI)_EhxqlT6S)+o/?cF5koyA{c&<n++(--hpor<}jU&s#OnHD`M>az/tMU2[');
define('AUTH_SALT',        '}mW7Q&W|wbLshXnZ{b rj/vkO3%_<:4Zc$~3.&O4F[S__$_e-W-6!SZ^J!}[e-u&');
define('SECURE_AUTH_SALT', 'r-flzGU2Uu>(sfL?F`_]giyWni%uKt}iym|)wuH^rFom~Q :Lw+m8m}IP9kS0F{[');
define('LOGGED_IN_SALT',   'Ox@>-u+@lgS0#(MQyL:Xan|&+s.Gq[$c+:sGG&u]-51T!d]Z}:%*aG7H!6K$;>@7');
define('NONCE_SALT',       'j*dbFR^.;ng_Fm5</5#rmk5/$VngTERa$-D0Vdv#@jow-];abKrT,_p@<_/gne}W');

 

if ( ! defined( 'ABSPATH' ) ) {
        define( 'ABSPATH','/wordpress');

 

 

5、經過域名訪問進行設置

 http://domain/wp-admin/install.phphtml

 

 

 

注:在安裝主題時,會須要你安裝ftp,咱們不須要安裝,直接在wp-config.php配置文件裏添加以下幾行便可
define("FS_METHOD","direct");

define("FS_CHMOD_DIR", 0777);

define("FS_CHMOD_FILE", 0777);
相關文章
相關標籤/搜索