基于nginx的wordpress部署安装

1 关闭防火墙

systemctl stop firewalld
setenforce  0

2 安装epel 源 nginx源

yum -y install epel-release wget
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
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 {
     
    server_name  www.wg007.com ;
    root   /usr/share/nginx/html/;
    location / {
     
        index  index.html index.php;
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ \.php$ {
     
        fastcgi_pass   127.0.0.1:9000;
        include        fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

7 hosts绑定域名,浏览器访问:
基于nginx的wordpress部署安装_第1张图片8 安装 wordpress

cd /usr/local/src
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
tar zxvf wordpress-4.9.4-zh_CN.tar.gz
mv wordpress/* /usr/share/nginx/html/
chmod  777 /usr/share/nginx/html/ -R

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的wordpress部署安装_第2张图片

你可能感兴趣的:(linux)