目錄
一、WordPress 簡介
二、基礎環境要求
三、安裝 mysql 環境
1、安裝mysql
2、啟動mysql
3、獲取默認密碼
4、登錄mysql5、修改密碼
5、創建wordpress資料庫并授權
四、安裝 nginx 環境
1、更新yum
2、安裝 nginx
3、添加組態檔
4、重新加載 nginx 配置
五、安裝 php 環境
1、安裝 php-fpm
2、啟動 php-fpm
3、修改所屬組
4、檢測 php-fpm 埠
六、安裝 wordpress
1、下載解壓
2、設定 wordpress
3、訪問配置 Wordpress
4、使用默認模板的網站前端
一、WordPress 簡介
WordPress是一種使用PHP語言開發的博客平臺,用戶可以在支持PHP和MySQL資料庫的服務器上 架設屬于自己的網站,也可以把 WordPress當作一個內容管理系統(CMS)來使用,WordPress是一 款個人博客系統,并逐步演化成一款內容管理系統軟體,它是使用PHP語言和MySQL資料庫開發的,用 戶可以在支持 PHP 和 MySQL資料庫的服務器上使用自己的博客,WordPress有許多第三方開發的免費 模板,安裝方式簡單易用,不過要做一個自己的模板,則需要你有一定的專業知識,比如你至少要懂的 標準通用標記語言下的一個應用HTML代碼、CSS、PHP等相關知識,WordPress官方支持中文版,同 時有愛好者開發的第三方中文語言包,如wopus中文語言包,WordPress擁有成千上萬個各式插件和不 計其數的主題模板樣式,
二、基礎環境要求
Mysql PHP nginx
三、安裝 mysql 環境
1、安裝mysql
[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# yum -y install mysql-community-server
2、啟動mysql
[root@localhost ~]# systemctl start mysqld
3、獲取默認密碼
[root@localhost ~]# grep "password" /var/log/mysqld.log
2021-11-06T10:54:44.085231Z 1 [Note] A temporary password is generated for root@localhost: -BimmRixd9Lw
4、登錄mysql5、修改密碼
[root@localhost ~]# mysql -uroot -p'-BimmRixd9Lw'
mysql> alter user 'root'@'localhost' identified by 'Lile@5201314';
5、創建wordpress資料庫并授權
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)
mysql> create user 'wordpress'@'localhost' identified by 'Qfedu.123com';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on wordpress.* to 'wordpress'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
四、安裝 nginx 環境
1、更新yum
[root@localhost ~]# sudo yum install -y epel-release
[root@localhost ~]# yum update
2、安裝 nginx
[root@localhost ~]# yum -y install nginx
3、添加組態檔
[root@localhost ~]# vi /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;
}
}
[root@localhost ~]# vi /etc/nginx/nginx.conf
4、重新加載 nginx 配置
[root@localhost ~]# systemctl restart nginx
五、安裝 php 環境
1、安裝 php-fpm
[root@localhost ~]# yum -y install php-fpm php-mysql
2、啟動 php-fpm
[root@localhost ~]# systemctl start php-fpm
3、修改所屬組
[root@localhost ~]# vi /etc/php-fpm.d/www.conf
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
[root@localhost ~]# systemctl restart php-fpm
4、檢測 php-fpm 埠
[root@localhost ~]# lsof -i:9000
六、安裝 wordpress
1、下載解壓
wordpress下載地址:https://wordpress.org/news/2017/01/wordpress-4-7-2-security-release/
[root@localhost ~]# tar xf wordpress-4.7.2-zh_CN.tar.gz
[root@localhost ~]# mv wordpress /
[root@localhost ~]# cd /
[root@localhost /]# chmod -R 777 wordpress/
2、設定 wordpress
[root@localhost ~]# cp /wordpress/wp-config-sample.php /wordpress/wp-config.php
[root@localhost ~]# vim /wordpress/wp-config.php
// ** MySQL 設定 - 具體資訊來自您正在使用的主機 ** //
/** WordPress資料庫的名稱 */
define('DB_NAME', 'wordpress');
/** MySQL資料庫用戶名 */
define('DB_USER', 'wordpress');
/** MySQL資料庫密碼 */
define('DB_PASSWORD', 'Qfedu.123com');
/** MySQL主機 */
define('DB_HOST', 'localhost');
/** 創建資料表時默認的文字編碼 */
define('DB_CHARSET', 'utf8');
3、訪問配置 Wordpress


4、使用默認模板的網站前端
注:在安裝主題時,會需要你安裝ftp,我們不需要安裝,直接在wp-config.php組態檔里添加如 下幾行即可
define("FS_METHOD","direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/350871.html
標籤:其他
