第一步:下載相關的軟件包
[root@zxw html]# yum install nginx php php-mysql
mariadb-server php-fpm -y
第二步:編輯php匹配規則
[root@zxw html]# vim /etc/nginx/nginx.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
index index.php index.html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location ~ php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
第四步:檢查並重啟
[root@zxw html]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@zxw html]# systemctl restart nginx
第五步:啟動php-fpm
[root@zxw html]# systemctl restart php-fpm
[root@zxw html]# ss -tnl
第五步;上傳包。配置數據庫文件
[root@zxw html]# cd /usr/share/nginx/html/
[root@zxw html]# rz
[root@zxw html]# unzip wordpress-3.3.1-zh_CN.zip
[root@zxw wordpress]# cp wp-config-sample.php wp-config.php
[root@zxw wordpress]# vim wp-config.php
define('DB_NAME', 'zxw');
/** MySQL 數據庫用戶名 */
define('DB_USER', 'zxw');
/** MySQL 數據庫密碼 */
define('DB_PASSWORD', 'zxw');
/** MySQL 主機 */
define('DB_HOST', 'localhost');
第六步:重啟數據庫
[root@zxw wordpress]# systemctl restart mariadb
第七步;創建數據庫用戶密碼
[root@zxw wordpress]# mysql -uroot
MariaDB [(none)]> create database zxw;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on zxw.* to zxw@'localhost' identified by '123'
Query OK, 0 rows affected (0.00 sec)