基於nginx的wordpress部署安裝

2021-10-24 05:14:37 字數 1975 閱讀 9107

1 關閉防火牆

systemctl stop firewalld

setenforce 0

2 安裝epel 源 nginx源

yum -y install epel-release wget

rpm -uvh

yum install -y nginx

systemctl enable nginx

systemctl start nginx

3 安裝mariadb

yum -y install mariadb mariadb-server

ystemctl enable mariadb

systemctl start mariadb

create database wordpress;

// 建立wordpress使用者,並設定密碼,密碼建議隨機生成,並且不少於8位,採用大小寫,數字,特殊字元組合

create all on *.* to 'wordpress'@'localhost' identified by '123456'

;flush privileges;

4 安裝php

yum -y install php php-fpm php-mysql

systemctl enable php-fpm

systemctl start php-fpm

5 編輯test.php

[root@localhost html]

# pwd

/usr/share/nginx/html

[root@localhost html]

# cat test.php

<?php

phpinfo();

?>

6 編輯wordpress.conf

server 

location ~ \.php$

}

7 hosts繫結網域名稱,瀏覽器訪問:

9 編輯wp-config.php

cd /usr/share/nginx/html/

cp wp-config-sample.php wp-config.php

修改資料庫名稱、使用者名稱、密碼

define(

'db_name', 'wordpress');

/** mysql資料庫使用者名稱 */

define(

'db_user', 'wordpress');

/** mysql資料庫密碼 */

define(

'db_password', '123456');

/** mysql主機 */

define(

'db_host', 'localhost');

/** 建立資料表時預設的文字編碼 */

define(

'db_charset', 'utf8'

);

10 瀏覽器按步驟安裝:

nginx 基於nginx的負載均衡

在瀏覽器中訪問http xx dev a.html,負載均衡效果,平均在8080和8081埠中。提前準備好兩個tomcat 埠號乙個是8081 另乙個是8080 在兩個tomcat中建立目錄dev 以及目錄下新增a.html。在nginx中配置檔案中 新增如下。nginx balance upstr...

nginx基於ssl的配置

nginx程式環境 配置檔案的組成部分 主配置檔案 nginx.conf include conf.d conf fastcgi,uwsgi,scgi等協議相關的配置檔案 mime.types 支援的mime型別 主程式檔案 usr sbin nginx unit file nginx.servic...

Nginx 基於Nginx的中介軟體架構

1 io 2 輕量級 3 cpu親和 affinity cpu親和 是一種把cpu核心和nginx工作程序繫結方式,把每個worker程序固定在乙個cpu上執行,減少切換的cachemiss,獲得良好的效能。4 sendfile 處理靜態檔案效率很高,因為他的傳輸機制是 sendfile。對比之前h...